File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -70,10 +70,10 @@ jobs:
70
70
--header "Authorization: Bearer ${TOKEN}" \
71
71
"https://ghcr.io/v2/${IMAGE}/blobs/${DIGEST}" \
72
72
| jq -r '.config')
73
- IMAGE_RELEASE=$(echo ${IMAGE_INFO} | jq -r '.Labels.build_version' | awk '{print $3}')
73
+ IMAGE_RELEASE=${TAG}
74
74
IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-nbxyz' '{print $1}')
75
75
NB_RELEASE_NUMBER=$(echo ${IMAGE_RELEASE} | awk -F'-nbxyz' '{print $2}')
76
- TAG_SHA=$(git rev-list -n 1 ${IMAGE_RELEASE})
76
+ TAG_SHA=$(git rev-list -n 1 "v ${IMAGE_RELEASE}" 2>/dev/null || echo "" )
77
77
if [ -z "${MULTIDIGEST}" ] || [ "${MULTIDIGEST}" == "null" ]; then
78
78
echo "**** No existing container build found, assuming first build ****"
79
79
VERSION_TAG=${WEBAPP_RELEASE}-nbxyz1
95
95
echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV
96
96
fi
97
97
98
+ # Ensure we don't create duplicate tags
99
+ while git rev-parse "v${VERSION_TAG}" >/dev/null 2>&1; do
100
+ echo "**** Tag v${VERSION_TAG} already exists, incrementing... ****"
101
+ NB_RELEASE_NUMBER=$(echo ${VERSION_TAG} | awk -F'-nbxyz' '{print $2}')
102
+ NB_RELEASE_NUMBER=$((NB_RELEASE_NUMBER + 1))
103
+ VERSION_TAG=$(echo ${VERSION_TAG} | awk -F'-nbxyz' '{print $1}')-nbxyz${NB_RELEASE_NUMBER}
104
+ echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV
105
+ done
106
+
98
107
- name : Docker meta
99
108
if : steps.version_check.outcome == 'success' && steps.version_check.conclusion == 'success'
100
109
id : meta
You can’t perform that action at this time.
0 commit comments