Skip to content

Commit 7dbeb59

Browse files
enhance image tag selection logic based on branch
1 parent 2940f00 commit 7dbeb59

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

.github/workflows/deploy-unified.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ on:
3535
build_docker_image:
3636
description: 'Build and push new Docker image'
3737
required: false
38-
default: true
38+
default: false
3939
type: boolean
4040

4141

@@ -213,10 +213,28 @@ jobs:
213213
echo "IMAGE_TAG=$UNIQUE_TAG" >> $GITHUB_OUTPUT
214214
echo "Generated unique Docker tag: $UNIQUE_TAG"
215215
else
216-
echo "🏷️ Using existing Docker image with tag: latest_waf"
217-
echo "IMAGE_TAG=latest_waf" >> $GITHUB_ENV
218-
echo "IMAGE_TAG=latest_waf" >> $GITHUB_OUTPUT
219-
echo "Using existing Docker image tag: latest_waf"
216+
echo "🏷️ Using existing Docker image based on branch..."
217+
BRANCH_NAME="${{ env.BRANCH_NAME }}"
218+
echo "Current branch: $BRANCH_NAME"
219+
220+
# Determine image tag based on branch
221+
if [[ "$BRANCH_NAME" == "main" ]]; then
222+
IMAGE_TAG="latest_waf"
223+
echo "Using main branch - image tag: latest_waf"
224+
elif [[ "$BRANCH_NAME" == "dev" ]]; then
225+
IMAGE_TAG="dev"
226+
echo "Using dev branch - image tag: dev"
227+
elif [[ "$BRANCH_NAME" == "demo" ]]; then
228+
IMAGE_TAG="demo"
229+
echo "Using demo branch - image tag: demo"
230+
else
231+
IMAGE_TAG="latest_waf"
232+
echo "Using default for branch '$BRANCH_NAME' - image tag: latest_waf"
233+
fi
234+
235+
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
236+
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_OUTPUT
237+
echo "Using existing Docker image tag: $IMAGE_TAG"
220238
fi
221239
222240
- name: Set up Docker Buildx

0 commit comments

Comments
 (0)