From dc8658e9e29cfee4affc0d870b65538de102e882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Segovia=20C=C3=B3rdoba?= Date: Sun, 8 May 2022 16:16:18 +0200 Subject: [PATCH] Fix publish sync --- .github/workflows/publish.yml | 142 ++++++++++------------------------ 1 file changed, 40 insertions(+), 102 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 26a1cd06fe1..e00958097e7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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/checkout@v3.0.1 + - uses: actions/checkout@v3 with: fetch-depth: 0 @@ -44,21 +43,14 @@ jobs: distribution: 'zulu' java-version: 11 - - name: build + - name: Build uses: gradle/gradle-build-action@v2.1.5 - if: matrix.os != 'windows-latest' with: - arguments: --full-stacktrace build + arguments: build --full-stacktrace - - name: mingwX64Test - uses: gradle/gradle-build-action@v2.1.5 - 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/upload-artifact@v3.0.0 @@ -66,78 +58,24 @@ jobs: 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/setup-java@v3.1.1 - 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/gradle-build-action@v2.1.5 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/gradle-build-action@v2.1.5 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/checkout@v3.0.1 - with: - fetch-depth: 0 - - - name: Set up Java - uses: actions/setup-java@v3.1.1 - with: - distribution: 'zulu' - java-version: 11 - - name: Prepare environment working-directory: arrow-site run: | @@ -154,19 +92,19 @@ 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 @@ -174,21 +112,21 @@ 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/${{ 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/) 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 @@ -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