@@ -67,40 +67,36 @@ jobs:
67
67
username : ${{ github.repository_owner }}
68
68
password : ${{ secrets.GITHUB_TOKEN }}
69
69
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
71
77
id : tag
72
78
shell : bash
73
79
run : |
74
- BUILD_NUMBER="$(git rev-list --count HEAD)"
75
- SHORT_HASH="$(git rev-parse --short=7 HEAD)"
76
80
REPO_OWNER="${GITHUB_REPOSITORY_OWNER@L}" # to lower case
77
81
REPO_NAME="${{ github.event.repository.name }}"
78
82
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
86
83
# list all tags possible
87
84
if [[ "${{ matrix.config.tag }}" == "cpu" ]]; then
88
85
TYPE=""
89
86
else
90
87
TYPE="-${{ matrix.config.tag }}"
91
88
fi
92
89
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 } }"
96
93
echo "full_output_tags=$FULLTAGS" >> $GITHUB_OUTPUT
97
94
echo "light_output_tags=$LIGHTTAGS" >> $GITHUB_OUTPUT
98
95
echo "server_output_tags=$SERVERTAGS" >> $GITHUB_OUTPUT
99
96
echo "full_output_tags=$FULLTAGS" # print out for debugging
100
97
echo "light_output_tags=$LIGHTTAGS" # print out for debugging
101
98
echo "server_output_tags=$SERVERTAGS" # print out for debugging
102
99
env :
103
- GITHUB_BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
104
100
GITHUB_REPOSITORY_OWNER : ' ${{ github.repository_owner }}'
105
101
106
102
- name : Free Disk Space (Ubuntu)
@@ -176,3 +172,10 @@ jobs:
176
172
# return to this if the experimental github cache is having issues
177
173
# cache-to: type=local,dest=/tmp/.buildx-cache
178
174
# cache-from: type=local,src=/tmp/.buildx-cache
175
+
176
+ - name : Create and push source tag
177
+ env :
178
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
179
+ run : |
180
+ git tag ${{ steps.srctag.outputs.name }} || exit 0
181
+ git push origin ${{ steps.srctag.outputs.name }} || exit 0
0 commit comments