Create main.yml to programmatically update AWS site

Updating the s3 bucket contents and invalidating the cloudfront distribution
This commit is contained in:
Alexander Bazzi 2024-02-23 18:14:00 -07:00 committed by GitHub
parent bbdd101952
commit 440c35e643
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

33
.github/workflows/main.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Deploy to AWS S3 and Invalidate CloudFront
on:
push:
branches:
- main # Adjust this to your repository's default branch
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Sync to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: www.xbazzi.com
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1' # e.g., us-east-1
SOURCE_DIR: './' # The root of your repository; adjust if your files are in a subdirectory
- name: Invalidate CloudFront Distribution
uses: chetan/invalidate-cloudfront-action@v1
env:
DISTRIBUTION: E3VV7PXHG95EM0
PATHS: '/*'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'