From 440c35e64368684e6048ebf61489ee31d6dba37b Mon Sep 17 00:00:00 2001 From: Alexander Bazzi Date: Fri, 23 Feb 2024 18:14:00 -0700 Subject: [PATCH] Create main.yml to programmatically update AWS site Updating the s3 bucket contents and invalidating the cloudfront distribution --- .github/workflows/main.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..368c61e --- /dev/null +++ b/.github/workflows/main.yml @@ -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'