From e0e08dfd0728a2cf96432b702624991979543523 Mon Sep 17 00:00:00 2001 From: Fabian Mendoza Date: Wed, 22 May 2024 17:16:22 -0400 Subject: [PATCH] Update, job for S3 and Cloudfront Deploy --- .github/workflows/main.yml | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b895637..1f64f64 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,12 @@ -name: Lintern +name: CI/CD Pipeline on: + push: + branches: + - main pull_request: branches: - - main # Adjust this to match your main branch name + - main jobs: test-and-lint: @@ -23,3 +26,30 @@ jobs: - name: Lint with npm run: npm run lint + + deploy: + needs: test-and-lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + 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: Install dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Deploy to S3 + run: aws s3 sync dist/ s3://flightsdeploybucket --delete + + - name: Invalidate CloudFront cache + run: aws cloudfront create-invalidation --distribution-id E1TASZURWXXX8L --paths "/*"