Skip to content

Commit f8c99ef

Browse files
committed
SBCOSS-399: updated workflow with modified image tag generation
1 parent eddfb92 commit f8c99ef

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/ghcr-publish.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ jobs:
2424
username: ${{ github.actor }}
2525
password: ${{ secrets.GITHUB_TOKEN }}
2626

27+
- name: Get short commit hash
28+
id: vars
29+
run: echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
30+
2731
- name: Prepare Docker image name and tag
2832
run: |
29-
# Force lowercase for repository name
3033
REPO_LC=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
31-
32-
# Use raw tag name (e.g., release_test_1.0), also force lowercase if needed
33-
IMAGE_TAG=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]')
34+
TAG_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]')
35+
BUILD_TAG="${TAG_NAME}_${{ steps.vars.outputs.commit_hash }}_${GITHUB_RUN_NUMBER}"
3436
3537
echo "IMAGE_NAME=ghcr.io/${REPO_LC}" >> $GITHUB_ENV
36-
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
38+
echo "IMAGE_TAG=${BUILD_TAG}" >> $GITHUB_ENV
3739
3840
- name: Build Docker image
3941
run: docker build -t $IMAGE_NAME:$IMAGE_TAG .

0 commit comments

Comments
 (0)