Deploy Documentation #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy Documentation | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build_and_deploy: | |
| name: Build and Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| working-directory: ./docs | |
| run: npm i -g pnpm && pnpm i | |
| - name: Build | |
| working-directory: ./docs | |
| run: pnpm run build | |
| - name: Deploy static site to S3 bucket | |
| working-directory: ./docs | |
| if: success() | |
| env: | |
| BUCKET_NAME: ${{ secrets.DOCS_S3_BUCKET }} | |
| run: aws s3 sync ./.vitepress/dist/ s3://$BUCKET_NAME --delete | |
| - name: Invalidate Cloudfront cache | |
| working-directory: ./docs | |
| if: success() | |
| env: | |
| DISTRIBUTION_ID: ${{ secrets.MAINNET_DISTRIBUTION_ID }} | |
| run: aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths '/*' |