Deploy Web #44
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 Web | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| deploy: | |
| name: Deploy Docusaurus Website to S3 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: web | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Docusaurus Website | |
| run: npm run build | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| aws-region: us-east-1 | |
| - name: Upload static assets with long cache | |
| run: | | |
| aws s3 sync build/ s3://agentvigilo.com \ | |
| --delete \ | |
| --exclude "*.html" \ | |
| --cache-control "public,max-age=31536000,immutable" | |
| - name: Upload HTML with short cache | |
| run: | | |
| aws s3 sync build/ s3://agentvigilo.com \ | |
| --exclude "*" \ | |
| --include "*.html" \ | |
| --cache-control "public,max-age=0,must-revalidate" | |
| - name: Invalidate CloudFront | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id E3UIV4SDTZNCBE \ | |
| --paths "/*" |