Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Commit

Permalink
build on tag pushes (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladupshot authored Feb 13, 2024
1 parent dc1d367 commit 397ce0f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/build_push_ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 397ce0f

Please sign in to comment.