Skip to content

Commit 894ad38

Browse files
changed the determine tag name based on branch condition
1 parent 35d837f commit 894ad38

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/docker-build-and-push.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,16 @@ jobs:
4949

5050
- name: Determine Tag Name Based on Branch
5151
id: determine_tag
52-
run: echo "tagname=${{ github.ref_name == 'main' && 'latest' || github.ref_name == 'dev' && 'dev' || github.ref_name == 'demo' && 'demo' || github.head_ref || 'default' }}" >> $GITHUB_OUTPUT
52+
run: |
53+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
54+
echo "tagname=latest" >> $GITHUB_ENV
55+
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
56+
echo "tagname=dev" >> $GITHUB_ENV
57+
elif [[ "${{ github.ref }}" == "refs/heads/demo" ]]; then
58+
echo "tagname=demo" >> $GITHUB_ENV
59+
else
60+
echo "tagnames=pullrequest-ignore" >> $GITHUB_ENV
61+
fi
5362
5463
- name: Build Docker Image and optionally push
5564
uses: docker/build-push-action@v6

0 commit comments

Comments
 (0)