feat: add deploy to s3 #1
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 | |
on: | |
push: | |
branches: | |
- 'main' | |
concurrency: | |
group: terraform-production | |
cancel-in-progress: true | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: yarn | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Build website | |
run: yarn build | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: arn:aws:iam::966137286427:role/github-actions-pixconf-pixconf-docs | |
- name: Deploy to S3 | |
run: aws s3 sync build/ s3://pixconf.vitalvas.dev/ --delete --acl=public-read --cache-control "max-age=43200, public" | |
- name: Invalidate CloudFront cache | |
run: aws cloudfront create-invalidation --distribution-id E2S6UYEG5JNF7H --paths "/*" |