@@ -68,40 +68,36 @@ jobs:
6868 username : ${{ github.repository_owner }}
6969 password : ${{ secrets.GITHUB_TOKEN }}
7070
71- - name : Determine tag name
71+ - name : Determine source tag name
72+ id : srctag
73+ uses : ./.github/actions/get-tag-name
74+ env :
75+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
76+
77+ - name : Determine image tag name
7278 id : tag
7379 shell : bash
7480 run : |
75- BUILD_NUMBER="$(git rev-list --count HEAD)"
76- SHORT_HASH="$(git rev-parse --short=7 HEAD)"
7781 REPO_OWNER="${GITHUB_REPOSITORY_OWNER@L}" # to lower case
7882 REPO_NAME="${{ github.event.repository.name }}"
7983
80- # determine tag name postfix (build number, commit hash)
81- if [[ "${{ env.GITHUB_BRANCH_NAME }}" == "master" ]]; then
82- TAG_POSTFIX="-b${BUILD_NUMBER}"
83- else
84- SAFE_NAME=$(echo "${{ env.GITHUB_BRANCH_NAME }}" | tr '/' '-')
85- TAG_POSTFIX="-${SAFE_NAME}-${SHORT_HASH}"
86- fi
8784 # list all tags possible
8885 if [[ "${{ matrix.config.tag }}" == "cpu" ]]; then
8986 TYPE=""
9087 else
9188 TYPE="-${{ matrix.config.tag }}"
9289 fi
9390 PREFIX="ghcr.io/${REPO_OWNER}/${REPO_NAME}:"
94- FULLTAGS="${PREFIX}full${TYPE},${PREFIX}full${TYPE}${TAG_POSTFIX }"
95- LIGHTTAGS="${PREFIX}light${TYPE},${PREFIX}light${TYPE}${TAG_POSTFIX }"
96- SERVERTAGS="${PREFIX}server${TYPE},${PREFIX}server${TYPE}${TAG_POSTFIX }"
91+ FULLTAGS="${PREFIX}full${TYPE},${PREFIX}full${TYPE}${{ steps.srctag.outputs.name } }"
92+ LIGHTTAGS="${PREFIX}light${TYPE},${PREFIX}light${TYPE}${{ steps.srctag.outputs.name } }"
93+ SERVERTAGS="${PREFIX}server${TYPE},${PREFIX}server${TYPE}${{ steps.srctag.outputs.name } }"
9794 echo "full_output_tags=$FULLTAGS" >> $GITHUB_OUTPUT
9895 echo "light_output_tags=$LIGHTTAGS" >> $GITHUB_OUTPUT
9996 echo "server_output_tags=$SERVERTAGS" >> $GITHUB_OUTPUT
10097 echo "full_output_tags=$FULLTAGS" # print out for debugging
10198 echo "light_output_tags=$LIGHTTAGS" # print out for debugging
10299 echo "server_output_tags=$SERVERTAGS" # print out for debugging
103100 env :
104- GITHUB_BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
105101 GITHUB_REPOSITORY_OWNER : ' ${{ github.repository_owner }}'
106102
107103 - name : Free Disk Space (Ubuntu)
@@ -177,3 +173,27 @@ jobs:
177173 # return to this if the experimental github cache is having issues
178174 # cache-to: type=local,dest=/tmp/.buildx-cache
179175 # cache-from: type=local,src=/tmp/.buildx-cache
176+
177+ create_tag :
178+ name : Create and push git tag
179+ runs-on : ubuntu-22.04
180+
181+ steps :
182+ - name : Clone
183+ id : checkout
184+ uses : actions/checkout@v4
185+ with :
186+ fetch-depth : 0
187+
188+ - name : Determine source tag name
189+ id : srctag
190+ uses : ./.github/actions/get-tag-name
191+ env :
192+ BRANCH_NAME : ${{ github.head_ref || github.ref_name }
193+
194+ - name : Create and push git tag
195+ env :
196+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
197+ run : |
198+ git tag ${{ steps.srctag.outputs.name }} || exit 0
199+ git push origin ${{ steps.srctag.outputs.name }} || exit 0
0 commit comments