Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publish sync #2717

Merged
merged 1 commit into from
May 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 40 additions & 102 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,19 @@ env:
SIGNING_KEY: '${{ secrets.SIGNING_KEY }}'
GRADLE_PUBLISH_KEY: '${{ secrets.GRADLE_PUBLISH_KEY }}'
GRADLE_PUBLISH_SECRET: '${{ secrets.GRADLE_PUBLISH_SECRET }}'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_CLOUDFRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID }}
AWS_DEFAULT_REGION: eu-west-1
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
JEKYLL_ENV: production
S3_BUCKET: ${{ secrets.S3_BUCKET }}

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'macos-latest', 'ubuntu-latest', 'windows-latest' ]

outputs:
arrow-version: ${{ steps.get-arrow-version.outputs.arrow-version }}

publish:
timeout-minutes: 150
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: actions/checkout@v3
with:
fetch-depth: 0

Expand All @@ -44,100 +43,39 @@ jobs:
distribution: 'zulu'
java-version: 11

- name: build
- name: Build
uses: gradle/[email protected]
if: matrix.os != 'windows-latest'
with:
arguments: --full-stacktrace build
arguments: build --full-stacktrace

- name: mingwX64Test
uses: gradle/[email protected]
if: matrix.os == 'windows-latest'
with:
arguments: --full-stacktrace mingwX64Test

- id: get-arrow-version
name: Get Arrow version
run: echo "::set-output name=arrow-version::$(head -n 1 build/semver/version.txt)"
- name: Get Arrow version
id: version
run: echo "::set-output name=arrow::$(head -n 1 build/semver/version.txt)"

- name: Upload reports
uses: actions/[email protected]
with:
name: 'reports-${{ matrix.os }}'
path: '**/build/reports/**'

- name: Stop Gradle daemons
run: ./gradlew --stop

publish:
needs: build
timeout-minutes: 120
runs-on: macos-latest

outputs:
arrow-version: ${{ steps.get-arrow-version.outputs.arrow-version }}

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Java
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: 11

- id: get-arrow-version
name: Get Arrow version
run: echo "::set-output name=arrow-version::${{needs.build.outputs.arrow-version}}"

- name: Publish alpha/beta/rc version
uses: gradle/[email protected]
if: |
contains(needs.build.outputs.arrow-version, 'alpha') ||
contains(needs.build.outputs.arrow-version, 'beta') ||
contains(needs.build.outputs.arrow-version, 'rc')
contains(steps.version.outputs.arrow, 'alpha') ||
contains(steps.version.outputs.arrow, 'beta') ||
contains(steps.version.outputs.arrow, 'rc')
with:
arguments: --full-stacktrace publishToSonatype closeAndReleaseSonatypeStagingRepository

- name: Publish final version
uses: gradle/[email protected]
if: |
!contains(needs.build.outputs.arrow-version, 'alpha') &&
!contains(needs.build.outputs.arrow-version, 'beta') &&
!contains(needs.build.outputs.arrow-version, 'rc')
!contains(steps.version.outputs.arrow, 'alpha') &&
!contains(steps.version.outputs.arrow, 'beta') &&
!contains(steps.version.outputs.arrow, 'rc')
with:
arguments: --full-stacktrace publishToSonatype closeSonatypeStagingRepository

- name: Stop Gradle daemons
run: ./gradlew --stop

publish_doc:
needs: publish
timeout-minutes: 60
runs-on: macos-latest

env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_CLOUDFRONT_ID: ${{ secrets.AWS_CLOUDFRONT_ID }}
AWS_DEFAULT_REGION: eu-west-1
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
JEKYLL_ENV: production
S3_BUCKET: ${{ secrets.S3_BUCKET }}

steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0

- name: Set up Java
uses: actions/[email protected]
with:
distribution: 'zulu'
java-version: 11

- name: Prepare environment
working-directory: arrow-site
run: |
Expand All @@ -154,41 +92,41 @@ jobs:
- name: Build release directory (/docs)
working-directory: arrow-site
if: |
!contains(needs.publish.outputs.arrow-version, 'alpha') &&
!contains(needs.publish.outputs.arrow-version, 'beta') &&
!contains(needs.publish.outputs.arrow-version, 'rc')
!contains(steps.version.outputs.arrow, 'alpha') &&
!contains(steps.version.outputs.arrow, 'beta') &&
!contains(steps.version.outputs.arrow, 'rc')
run: |
bundle exec jekyll build -b docs -s docs
tree _site > $BASEDIR/logs/content_docs-${{ needs.publish.outputs.arrow-version }}.log
tree _site > $BASEDIR/logs/content_docs-${{ steps.version.outputs.arrow }}.log

- name: Publish documentation (/docs)
working-directory: arrow-site
if: |
!contains(needs.publish.outputs.arrow-version, 'alpha') &&
!contains(needs.publish.outputs.arrow-version, 'beta') &&
!contains(needs.publish.outputs.arrow-version, 'rc')
!contains(steps.version.outputs.arrow, 'alpha') &&
!contains(steps.version.outputs.arrow, 'beta') &&
!contains(steps.version.outputs.arrow, 'rc')
run: |
echo ">>> Latest release" >> $BASEDIR/logs/aws_sync.log
${GITHUB_WORKSPACE}/.github/scripts/sync-docs-with-aws.sh

- name: Build release directory (/docs/<major.minor>)
working-directory: arrow-site
if: |
!contains(needs.publish.outputs.arrow-version, 'alpha') &&
!contains(needs.publish.outputs.arrow-version, 'beta') &&
!contains(needs.publish.outputs.arrow-version, 'rc')
!contains(steps.version.outputs.arrow, 'alpha') &&
!contains(steps.version.outputs.arrow, 'beta') &&
!contains(steps.version.outputs.arrow, 'rc')
run: |
bundle exec jekyll build -b docs/${{ needs.publish.outputs.arrow-version }} -s docs
tree _site > $BASEDIR/logs/content_docs-${{ needs.publish.outputs.arrow-version }}.log
bundle exec jekyll build -b docs/${{ steps.version.outputs.arrow }} -s docs
tree _site > $BASEDIR/logs/content_docs-${{ steps.version.outputs.arrow }}.log

- name: Publish release directory (/docs/<major.minor>)
working-directory: arrow-site
if: |
!contains(needs.publish.outputs.arrow-version, 'alpha') &&
!contains(needs.publish.outputs.arrow-version, 'beta') &&
!contains(needs.publish.outputs.arrow-version, 'rc')
!contains(steps.version.outputs.arrow, 'alpha') &&
!contains(steps.version.outputs.arrow, 'beta') &&
!contains(steps.version.outputs.arrow, 'rc')
run: |
aws s3 sync _site s3://$S3_BUCKET/docs/${{ needs.publish.outputs.arrow-version }} --delete --exclude "/CNAME" --exclude "/code/*" --exclude "/index.html" --exclude "/redirects.json" >> $BASEDIR/logs/aws_sync.log
aws s3 sync _site s3://$S3_BUCKET/docs/${{ steps.version.outputs.arrow }} --delete --exclude "/CNAME" --exclude "/code/*" --exclude "/index.html" --exclude "/redirects.json" >> $BASEDIR/logs/aws_sync.log

- name: Build latest version (/docs/next)
working-directory: arrow-site
Expand All @@ -203,9 +141,9 @@ jobs:

- name: Publish sitemap.xml
if: |
!contains(needs.publish.outputs.arrow-version, 'alpha') &&
!contains(needs.publish.outputs.arrow-version, 'beta') &&
!contains(needs.publish.outputs.arrow-version, 'rc')
!contains(steps.version.outputs.arrow, 'alpha') &&
!contains(steps.version.outputs.arrow, 'beta') &&
!contains(steps.version.outputs.arrow, 'rc')
run: |
${GITHUB_WORKSPACE}/.github/scripts/create-sitemap.sh > sitemap.xml
aws s3 cp sitemap.xml s3://$S3_BUCKET/sitemap.xml >> $BASEDIR/logs/aws_sync.log
Expand Down