File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff 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 .
You can’t perform that action at this time.
0 commit comments