Deploy #175
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 | |
paths-ignore: | |
- 'README.md' | |
- '.editorconfig' | |
- '.gitignore' | |
- '.github/**' | |
- '.nvmrc' | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
name: Build & Deploy Static Site | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Source Code | |
uses: actions/checkout@v3 | |
- name: Validate AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Sync src to S3 | |
run: | | |
aws s3 sync src s3://brandonwkipp.com --cache-control public,max-age=0,must-revalidate --include "*" --exclude "*.css" --exclude "images/*" --exclude "src/blog/*" --delete | |
aws s3 sync src s3://brandonwkipp.com --cache-control public,max-age=31536000,immutable --exclude "*" --include "*.css" --delete | |
aws s3 sync s3://brandonwkipp-images s3://brandonwkipp.com/images --cache-control public,max-age=31536000,immutable --delete | |
- name: Invalidate Cloudfront | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_ID}} --paths "/*" |