From 716cbc7ac9365a42dd0d6414e7c4fff1f26411d7 Mon Sep 17 00:00:00 2001 From: Nam Hoang Date: Wed, 30 Aug 2023 10:39:38 +0700 Subject: [PATCH] chore: set environment for github action Signed-off-by: Nam Hoang --- .github/workflows/build-and-deploy-agent.yml | 11 +++++++++-- .github/workflows/deploy-to-s3.yml | 12 +++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-deploy-agent.yml b/.github/workflows/build-and-deploy-agent.yml index a0483a92..875f1004 100644 --- a/.github/workflows/build-and-deploy-agent.yml +++ b/.github/workflows/build-and-deploy-agent.yml @@ -3,7 +3,10 @@ name: Build and Deploy Agent on: push: branches: + - dev - next + tags: + - '*' jobs: install_and_build: @@ -15,6 +18,8 @@ jobs: env: CI: false + environment: ${{ (github.ref == 'refs/heads/dev' && 'dev') || (startsWith(github.ref, 'refs/tags/v') && 'UN') }} + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -25,7 +30,7 @@ jobs: pip3 install awscli --upgrade --user - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v3 with: role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }} aws-region: ${{ secrets.AWS_REGION }} @@ -47,6 +52,8 @@ jobs: permissions: id-token: write + environment: ${{ (github.ref == 'refs/heads/dev' && 'dev') || (startsWith(github.ref, 'refs/tags/v') && 'UN') }} + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -57,7 +64,7 @@ jobs: pip3 install awscli --upgrade --user - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v3 with: role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }} aws-region: ${{ secrets.AWS_REGION }} diff --git a/.github/workflows/deploy-to-s3.yml b/.github/workflows/deploy-to-s3.yml index a2ae97b8..792a9ac0 100644 --- a/.github/workflows/deploy-to-s3.yml +++ b/.github/workflows/deploy-to-s3.yml @@ -3,7 +3,9 @@ name: Deploy to S3 on: push: branches: - - next + - dev + tags: + - '*' jobs: install_and_build: @@ -12,13 +14,15 @@ jobs: env: CI: false + environment: ${{ (github.ref == 'refs/heads/dev' && 'dev') || (startsWith(github.ref, 'refs/tags/v') && 'UN') }} + steps: - name: Checkout repository uses: actions/checkout@v3 - name: Cache dependencies id: cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.pnpm-store key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} @@ -63,6 +67,8 @@ jobs: permissions: id-token: write + environment: ${{ (github.ref == 'refs/heads/dev' && 'dev') || (startsWith(github.ref, 'refs/tags/v') && 'UN') }} + steps: - name: Checkout repository uses: actions/checkout@v3 @@ -79,7 +85,7 @@ jobs: pip3 install awscli --upgrade --user - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v2 + uses: aws-actions/configure-aws-credentials@v3 with: role-to-assume: ${{ secrets.AWS_ROLE_GITHUB_ACTION_ARN }} aws-region: ${{ secrets.AWS_REGION }}