Merge pull request #108 from dpup/dependabot/npm_and_yarn/all-b71006b10e #101
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 Website | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: deploy_website | |
| cancel-in-progress: true | |
| jobs: | |
| deploy_website: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Setup 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: ${{ vars.AWS_REGION }} | |
| - uses: 'actions/checkout@v4' | |
| - name: 'Install PNPM' | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 8 | |
| - name: 'Install Node' | |
| uses: 'actions/setup-node@v4' | |
| with: | |
| node-version: 18 | |
| cache: 'pnpm' | |
| - name: 'Install dependencies' | |
| run: pnpm install | |
| - name: 'Generating Astro build' | |
| env: | |
| GOOGLE_API_KEY: ${{ vars.GOOGLE_API_KEY }} | |
| run: pnpm run build | |
| - id: deploy-assets | |
| name: Deploy fingerprinted assets to s3 | |
| run: aws s3 sync ./dist/_astro s3://${{ vars.S3_BUCKET_NAME }}/_astro --size-only --cache-control max-age=31536000 | |
| - id: deploy-other | |
| name: Deploy everything else to s3 | |
| run: aws s3 sync ./dist/ s3://${{ vars.S3_BUCKET_NAME }}/ --size-only --cache-control max-age=60 --exclude "*_astro/*" | |
| - name: Invalidate cloudfront cache | |
| run: aws cloudfront create-invalidation --distribution-id ${{ vars.CF_DISTRO_ID }} --paths "/*" "/" |