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:
7070 --header "Authorization: Bearer ${TOKEN}" \
7171 "https://ghcr.io/v2/${IMAGE}/blobs/${DIGEST}" \
7272 | jq -r '.config')
73- IMAGE_RELEASE=$(echo ${IMAGE_INFO} | jq -r '.Labels.build_version' | awk '{print $3}')
73+ IMAGE_RELEASE=${TAG}
7474 IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-nbxyz' '{print $1}')
7575 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 "" )
7777 if [ -z "${MULTIDIGEST}" ] || [ "${MULTIDIGEST}" == "null" ]; then
7878 echo "**** No existing container build found, assuming first build ****"
7979 VERSION_TAG=${WEBAPP_RELEASE}-nbxyz1
9595 echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV
9696 fi
9797
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+
98107 - name : Docker meta
99108 if : steps.version_check.outcome == 'success' && steps.version_check.conclusion == 'success'
100109 id : meta
You can’t perform that action at this time.
0 commit comments