Skip to content

Commit

Permalink
Add GitHub action to deploy to S3 and invalidate Cloudfront cache
Browse files Browse the repository at this point in the history
  • Loading branch information
paddyohanlon committed Oct 15, 2024
1 parent 89e928d commit 21df690
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/aws-s3-cloudfront-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy to S3 and invalidate Cloudfront cache
on: [push]
jobs:
run:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Deploy
uses: reggionick/s3-deploy@v4
with:
folder: dist
bucket: ${{ secrets.S3_BUCKET }}
bucket-region: ${{ secrets.S3_BUCKET_REGION }}
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
invalidation: /
delete-removed: true
no-cache: true
private: true
files-to-include: '{.*/**,**}'

0 comments on commit 21df690

Please sign in to comment.