More progress #99
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: dev | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: | |
name: dev | |
url: https://dev.farese.com | |
env: | |
CLOUDFRONT_ID: ${{ secrets.CLOUDFRONT_ID }} | |
S3_BUCKET: ${{ secrets.S3_BUCKET }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- run: npm ci | |
- name: Generate service worker | |
run: npm run build:serviceworker | |
- name: Upload to S3 | |
run: | | |
aws s3 sync \ | |
. \ | |
s3://$S3_BUCKET/ \ | |
--delete \ | |
--exclude ".*" \ | |
--exclude "README.md" | |
- name: Set no-cache on the service worker | |
run: | | |
aws s3 cp \ | |
s3://$S3_BUCKET/sw.js \ | |
s3://$S3_BUCKET/sw.js \ | |
--metadata-directive REPLACE \ | |
--cache-control no-cache | |
- name: Invalidate Cloudfront cache | |
run: | | |
aws cloudfront create-invalidation \ | |
--distribution-id $CLOUDFRONT_ID \ | |
--paths "/*" |