From 178096ddf991a7539f6bb8c562d0a3fae42afa96 Mon Sep 17 00:00:00 2001 From: Sotatek-TinnNguyen Date: Mon, 8 Jan 2024 14:26:38 +0700 Subject: [PATCH] update cicd --- .github/workflows/dev.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index b494a66..d7d2ee1 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -19,7 +19,7 @@ jobs: - name: Get AWS ops credentials uses: aws-actions/configure-aws-credentials@v1 with: - role-to-assume: ${{ secrets.AWS_DEV_IAM_ROLE_ARN }} + role-to-assume: ${{ secrets.AWS_IAM_ROLE_ARN_PROD }} role-session-name: github-action-tx-latency-measurement aws-region: ${{ secrets.AWS_REGION }} @@ -30,17 +30,15 @@ jobs: - name: Build, tag, and push image to Amazon ECR env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - ECR_REPOSITORY: ${{ secrets.AWS_DEV_ECR_REPOSITORY }} - IMAGE_TAG: ${{ github.sha }} + ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY_PROD }} run: | + git_hash=$(git rev-parse --short "$GITHUB_SHA") for dir in */; do dir=${dir%/} if [ -f "$dir/Dockerfile" ]; then cd $dir - ls -la echo "Building image in $dir" - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$dir-${IMAGE_TAG} . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$dir-${IMAGE_TAG} + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$dir-$git_hash . cd - fi done