Skip to content

Commit

Permalink
edit image tagging rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-TuLe2 committed Jul 19, 2024
1 parent ab540b9 commit 0b6ecba
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/prod-build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: kaia-websites-api build image workflow for PROD env
on:
push:
branches: ["main","modify-cicd"]
branches: ["main", "modify-cicd"]

jobs:
deploy:
Expand All @@ -25,13 +25,15 @@ jobs:
uses: aws-actions/amazon-ecr-login@v1
id: login-ecr

- name: Extract commit hash
id: vars
run: echo "::set-output name=hash::$(git rev-parse --short HEAD)"

- name: Build, tag, and push image API to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: ${{ github.ref_name }}
IMAGE_TAG: ${{ steps.vars.outputs.hash }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

0 comments on commit 0b6ecba

Please sign in to comment.