Merge pull request #252 from MontaiLL/patch-6 #254
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: Publish | |
on: | |
push: | |
branches: [master] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: eu-central-1 | |
AWS_DISTRIBUTION_ID: ${{ secrets.AWS_DISTRIBUTION_ID }} | |
AWS_BUCKET_NAME: ${{ secrets.AWS_BUCKET_NAME }} | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: Build website | |
run: npm ci && npm run build | |
- name: Sync files to S3 | |
run: aws s3 sync ./build/ s3://$AWS_BUCKET_NAME --acl public-read --delete --cache-control max-age=604800 | |
- name: Notify CloudFront about the changes | |
run: aws cloudfront create-invalidation --distribution-id ${AWS_DISTRIBUTION_ID} --paths "/*" |