From ce3acd530fb4fd1a40c91fba05871baae8d73268 Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Wed, 18 Dec 2024 13:51:14 +0530 Subject: [PATCH 1/3] AWS Publish Workflow Testing --- .github/workflows/aws-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/aws-publish.yml b/.github/workflows/aws-publish.yml index 300944a..0d3fc90 100644 --- a/.github/workflows/aws-publish.yml +++ b/.github/workflows/aws-publish.yml @@ -27,6 +27,8 @@ jobs: # Step 4: Build the project - name: Build package run: npm run build + - name: List all files + run: ls -la # Step 5: Zip the build output # - name: Create deployment package # run: zip -r build.zip ./build @@ -39,4 +41,4 @@ jobs: # Step 7: Upload to S3 - name: Upload to S3 run: | - aws s3 cp ./dist s3://universal-login-sample-app --acl public-read \ No newline at end of file + aws s3 cp ./dist s3://universal-login-sample-app/ --recursive --acl public-read \ No newline at end of file From cee819c6e3deff82765f018747a00dbd186dcf3e Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Wed, 18 Dec 2024 13:54:29 +0530 Subject: [PATCH 2/3] Removing ACL Condition --- .github/workflows/aws-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/aws-publish.yml b/.github/workflows/aws-publish.yml index 0d3fc90..55b992d 100644 --- a/.github/workflows/aws-publish.yml +++ b/.github/workflows/aws-publish.yml @@ -41,4 +41,4 @@ jobs: # Step 7: Upload to S3 - name: Upload to S3 run: | - aws s3 cp ./dist s3://universal-login-sample-app/ --recursive --acl public-read \ No newline at end of file + aws s3 cp ./dist s3://universal-login-sample-app/ --recursive \ No newline at end of file From a79fc73e64f286593521db509666387a47f9f0ec Mon Sep 17 00:00:00 2001 From: Snehil Kishore Date: Wed, 18 Dec 2024 16:21:32 +0530 Subject: [PATCH 3/3] Final Changes --- .github/workflows/aws-publish.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/aws-publish.yml b/.github/workflows/aws-publish.yml index 55b992d..46948cc 100644 --- a/.github/workflows/aws-publish.yml +++ b/.github/workflows/aws-publish.yml @@ -1,9 +1,10 @@ name: Build and Deploy to AWS S3 on: - pull_request: + push: branches: - master # Trigger on PRs targeting 'master' branch workflow_dispatch: + jobs: build-and-deploy: runs-on: ubuntu-latest @@ -14,6 +15,7 @@ jobs: # Step 1: Checkout the code - name: Checkout code uses: actions/checkout@v4 + # Step 2: Set up Node.js - name: Setup Node.js uses: actions/setup-node@v4 @@ -21,24 +23,24 @@ jobs: node-version: 18 cache: 'npm' registry-url: 'https://registry.npmjs.org' + # Step 3: Install dependencies - name: Install dependencies run: npm ci --include=dev + # Step 4: Build the project - name: Build package run: npm run build - - name: List all files - run: ls -la - # Step 5: Zip the build output - # - name: Create deployment package - # run: zip -r build.zip ./build - # Step 6: Configure AWS credentials via OIDC + + # Step 5: Configure AWS credentials via OIDC - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: arn:aws:iam::913524902005:role/GA_UL_Sample_App + role-to-assume: ${{ secrets.AWS_S3_ARN }} aws-region: ap-southeast-2 - # Step 7: Upload to S3 + mask-aws-account-id: true + + # Step 6: Upload to S3 - name: Upload to S3 run: | aws s3 cp ./dist s3://universal-login-sample-app/ --recursive \ No newline at end of file