From f2dd9879b4d7476220207d86804ab2bd3ad422bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Test=C3=A9?= Date: Wed, 11 Jan 2023 18:58:08 +0100 Subject: [PATCH] chore(ci): move doc publishing to its own workflow This workflow depend on the execution of aws_build.yml when executed on default branch. --- .github/workflows/aws_build.yml | 2 +- .github/workflows/continuous-integration.yml | 38 ------------------- .github/workflows/publish_doc.yml | 40 ++++++++++++++++++++ 3 files changed, 41 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/publish_doc.yml diff --git a/.github/workflows/aws_build.yml b/.github/workflows/aws_build.yml index 2aa476da2..a7cc716f9 100644 --- a/.github/workflows/aws_build.yml +++ b/.github/workflows/aws_build.yml @@ -1,5 +1,5 @@ # Build on an AWS instance. -name: AWS EC2 build +name: AwsEc2Build on: workflow_dispatch: diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 1f4128011..6925fea0e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -96,44 +96,6 @@ jobs: # Releasing and Testing Packages # ################################## - PublishDoc: - needs: [BuildAndTest] - - runs-on: ubuntu-20.04 - if: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') }} - - steps: - - name: Set env - id: vars - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> "${GITHUB_ENV}" - - name: Download Documentation - id: download - uses: actions/download-artifact@v3 - with: - name: html-docs - - name: Publish Documentation to S3 - id: publish - if: ${{ steps.download.outcome == 'success' && !cancelled() }} - uses: jakejarvis/s3-sync-action@be0c4ab89158cac4278689ebedd8407dd5f35a83 - with: - args: --acl public-read - env: - AWS_S3_BUCKET: ${{ secrets.AWS_PREPROD_REPO_DOCUMENTATION_BUCKET_NAME }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_REGION: ${{ secrets.AWS_REGION }} - SOURCE_DIR: '.' - DEST_DIR: 'concrete-compiler/${{ env.RELEASE_VERSION }}' - - name: Invalidate CloudFront Cache - if: ${{ steps.publish.outcome == 'success' }} - uses: awact/cloudfront-action@8bcfabc7b4bbc0cb8e55e48527f0e3a6d681627c - env: - SOURCE_PATH: '/concrete-compiler/*' - AWS_REGION: ${{ secrets.AWS_REGION }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - DISTRIBUTION_ID: ${{ secrets.AWS_REPO_DOCUMENTATION_DISTRIBUTION_ID }} - CreateRelease: runs-on: ubuntu-20.04 needs: [BuildAndTest, BuildAndTestMacOS] diff --git a/.github/workflows/publish_doc.yml b/.github/workflows/publish_doc.yml new file mode 100644 index 000000000..1f8d05771 --- /dev/null +++ b/.github/workflows/publish_doc.yml @@ -0,0 +1,40 @@ +name: Publish documentation + +on: + workflow_run: + workflows: [AwsEc2Build] + types: + - completed + +jobs: + PublishDoc: + runs-on: ubuntu-20.04 + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Download Documentation + id: download + uses: actions/download-artifact@v3 + with: + name: html-docs + - name: Publish Documentation to S3 + id: publish + if: ${{ steps.download.outcome == 'success' && !cancelled() }} + uses: jakejarvis/s3-sync-action@be0c4ab89158cac4278689ebedd8407dd5f35a83 + with: + args: --acl public-read + env: + AWS_S3_BUCKET: ${{ secrets.AWS_PREPROD_REPO_DOCUMENTATION_BUCKET_NAME }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + SOURCE_DIR: '.' + DEST_DIR: 'concrete-compiler/${{ github.ref_name }}' + - name: Invalidate CloudFront Cache + if: ${{ steps.publish.outcome == 'success' }} + uses: awact/cloudfront-action@8bcfabc7b4bbc0cb8e55e48527f0e3a6d681627c + env: + SOURCE_PATH: '/concrete-compiler/*' + AWS_REGION: ${{ secrets.AWS_REGION }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + DISTRIBUTION_ID: ${{ secrets.AWS_REPO_DOCUMENTATION_DISTRIBUTION_ID }}