From 397ce0f940b70f7762be2e1410e835d9ab2fbf37 Mon Sep 17 00:00:00 2001 From: vladupshot <154623109+vladupshot@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:19:17 +1300 Subject: [PATCH] build on tag pushes (#54) --- .github/workflows/build_push_ecr.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_push_ecr.yml b/.github/workflows/build_push_ecr.yml index 0e1ca85..873d0c7 100644 --- a/.github/workflows/build_push_ecr.yml +++ b/.github/workflows/build_push_ecr.yml @@ -3,10 +3,14 @@ name: Build and Push docker image to ECR on: + # push: + # branches: + # - main + # pull_request: push: - branches: - - main - pull_request: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - dev-latest concurrency: group: ${{ github.ref }} @@ -38,11 +42,14 @@ jobs: ECR_REPOSITORY: ${{github.event.repository.name}} # Naming convention: ECR registry name == GITHUB repo name MAIN_BRANCH: main # Images from this branch will be tagged as "latest" run: | + #! Due to we trigger on push.tags GITHUB_REF - is the tag name + GIT_TAG="${GITHUB_REF}" + IMAGE_TAG="${GITHUB_SHA:0:8}" - EXTRA_IMAGE_TAGS="dev-latest" + EXTRA_IMAGE_TAGS=$GIT_TAG - #! Add latest tag only if on MAIN_BRANCH branch - if [[ ${GITHUB_REF} == "refs/heads/${MAIN_BRANCH}" ]]; then + #! Add latest tag only if on named releases tag='v*' + if [[ ${GIT_TAG} == v* ]]; then EXTRA_IMAGE_TAGS="${EXTRA_IMAGE_TAGS};latest" fi