videos #183
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: Build & Deploy | |
on: | |
push: | |
branches: [ main, dev ] | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Install | |
run: npm install | |
- name: Build | |
run: | | |
npm run build | |
- 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: eu-west-1 | |
- name: Upload to S3 | |
run: | | |
cd ./dist | |
aws s3 cp --quiet --recursive --cache-control="max-age=31536000" . s3://${{ secrets.S3_BUCKET }}/${GITHUB_REF##*/}/ | |
- name: Invalidate CloudFront | |
if: ${{ github.ref == 'refs/heads/dev' }} | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DISTRIBUTION_DEV }} --paths "/*" | |
- name: Invalidate CloudFront | |
if: ${{ github.ref != 'refs/heads/dev' }} | |
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DISTRIBUTION }} --paths "/*" |