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