Release v0.0.13 #18
Workflow file for this run
This file contains 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 site | |
on: | |
release: | |
types: [ created ] | |
workflow_dispatch: | |
jobs: | |
deploy: | |
name: Deploy site | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ vars.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- name: Sync HTML files to the S3 bucket | |
run: aws s3 sync dist/ s3://${{ vars.AWS_S3_BUCKET }}/ --exclude=* --include=*.html --cache-control="public,max-age=86400,s-maxage=604800" | |
- name: Fetch rates, so they are not deleted in next step | |
continue-on-error: true | |
run: aws s3 cp s3://${{ vars.AWS_S3_BUCKET }}/currency-rates.json dist/currency-rates.json | |
- name: Sync other files to S3 bucket | |
run: aws s3 sync dist/ s3://${{ vars.AWS_S3_BUCKET }}/ --cache-control="public,max-age=31536000,immutable" --delete | |
- name: Update service worker metadata | |
run: aws s3 cp dist/sw.js s3://${{ vars.AWS_S3_BUCKET }}/sw.js --cache-control="no-cache,no-store" | |
- name: Run CloudFront invalidation | |
run: aws cloudfront create-invalidation --distribution-id ${{ vars.AWS_CLOUDFRONT_DIST }} --paths "/*" |