From 553f77f19bc6fcf618aefa1cd6f80d96c0ce9be9 Mon Sep 17 00:00:00 2001 From: Umut Date: Tue, 17 Aug 2021 18:03:57 +0300 Subject: [PATCH] chore(ci): implement publishing docs to hdk.zama.ai on push to main --- .github/workflows/continuous-integration.yaml | 56 ++++++++++++++++++- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index c498d1933..aa4a51884 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -1,6 +1,9 @@ -name: hdk PR checks - -on: [pull_request] +name: HDK CI Pipeline +on: + pull_request: + push: + branches: + - main jobs: build: @@ -104,3 +107,50 @@ jobs: SLACK_MESSAGE: 'Build finished with status ${{ job.status }}' SLACK_USERNAME: zama-bot SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + publish-docs: + needs: [build] + + runs-on: ubuntu-20.04 + if: ${{ github.event_name == 'push' && github.base_ref == 'main' }} + + steps: + - name: Download Documentation + id: download + uses: actions/download-artifact@v2 + with: + name: html-docs + + - name: Publish Documentation to S3 + id: publish + if: ${{ steps.download.outcome == 'success' && !cancelled() }} + uses: jakejarvis/s3-sync-action@master + with: + args: --delete + env: + AWS_S3_BUCKET: ${{ secrets.AWS_HDK_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: '.' + + - name: Invalidate CloudFront Cache + if: ${{ steps.publish.outcome == 'success' }} + uses: awact/cloudfront-action@master + env: + SOURCE_PATH: '/*' + 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_HDK_DOCUMENTATION_DISTRIBUTION_ID }} + + - name: Slack Notification + if: ${{ always() }} + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: hdk-updates + SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png + SLACK_COLOR: ${{ job.status }} + SLACK_MESSAGE: 'Publishing documentation finished with status ${{ job.status }}' + SLACK_USERNAME: zama-bot + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}