From bc963ddb368a15b27a395b38bd8055c33eb53bc5 Mon Sep 17 00:00:00 2001 From: Dilip Kola Date: Fri, 14 Jun 2024 14:54:51 +0530 Subject: [PATCH] chore: update deploy-to-s3.yml workflow --- .github/workflows/deploy-to-s3.yml | 63 +++++++++++++++--------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/.github/workflows/deploy-to-s3.yml b/.github/workflows/deploy-to-s3.yml index 619886e..9968a12 100644 --- a/.github/workflows/deploy-to-s3.yml +++ b/.github/workflows/deploy-to-s3.yml @@ -14,34 +14,35 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v4.1.1 - - - name: Setup Node.js with .nvmrc - uses: actions/setup-node@v4.0.1 - with: - node-version-file: '.nvmrc' - cache: 'npm' - - - name: Install Yarn - run: npm install -g yarn - - - name: Install dependencies - run: yarn install - - - name: Build React App with Vite - run: yarn build - - - name: Assume IAM Role and Set AWS Credentials - id: assume-role - uses: aws-actions/configure-aws-credentials@v4.0.1 - with: - aws-region: us-east-1 - role-to-assume: ${{ secrets.AWS_IAM_ROLE_ARN }} - role-duration-seconds: 900 # Adjust as needed - - - name: Synchronize with S3 and Invalidate CloudFront - run: | - cd dist - aws s3 sync . s3://transformers-workflow-engine --delete - aws cloudfront create-invalidation --distribution-id E2PO7XUKI9DBAP --paths "/*" + - name: Checkout code + uses: actions/checkout@v4.1.1 + + - name: Setup Node.js with .nvmrc + uses: actions/setup-node@v4.0.1 + with: + node-version-file: '.nvmrc' + cache: 'npm' + + - name: Install Yarn + run: npm install -g yarn + + - name: Install dependencies + run: yarn install + + - name: Build React App with Vite + run: yarn build + + - name: Assume IAM Role and Set AWS Credentials + id: assume-role + uses: aws-actions/configure-aws-credentials@v4.0.1 + with: + aws-region: us-east-1 + role-to-assume: ${{ secrets.AWS_IAM_ROLE_ARN }} + role-duration-seconds: 900 # Adjust as needed + + - name: Synchronize with S3 and Invalidate CloudFront + run: | + aws s3 rm s3://transformers-workflow-engine/assets --recursive + cd dist + aws s3 sync . s3://transformers-workflow-engine/ + aws cloudfront create-invalidation --distribution-id E2PO7XUKI9DBAP --paths "/*"