Skip to content

Commit 019a2e8

Browse files
committed
GHA updates.
1 parent 7db20b0 commit 019a2e8

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

.github/workflows/docker-build.yml

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,22 @@ jobs:
3333
with:
3434
images: cogstacksystems/jupyter-hub
3535
tags: |
36-
37-
# vX.Y.Z -> X.Y.Z and X.Y (strip "v")
38-
type=semver,pattern={{version}},prefix=v
39-
type=semver,pattern={{major}}.{{minor}},prefix=v
40-
# latest on main AND on v-tags
41-
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
42-
# branches (non-PR)
43-
type=ref,event=branch,enable=${{ github.event_name != 'pull_request' }}
44-
# short sha
45-
type=sha,format=short
36+
# vX.Y.Z -> X.Y.Z and X.Y (strip leading "v")
37+
type=semver,pattern={{version}},prefix=v
38+
type=semver,pattern={{major}}.{{minor}},prefix=v
39+
# latest on main and on v-tags
40+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
41+
# branch tag for non-PR branches
42+
type=ref,event=branch,enable=${{ github.event_name != 'pull_request' }}
43+
# short sha
44+
type=sha,format=short
4645
4746
- name: Docker meta (singleuser)
4847
id: meta_su
4948
uses: docker/metadata-action@v5
5049
with:
5150
images: cogstacksystems/jupyter-singleuser
5251
tags: |
53-
5452
# vX.Y.Z -> X.Y.Z and X.Y (strip "v")
5553
type=semver,pattern={{version}},prefix=v
5654
type=semver,pattern={{major}}.{{minor}},prefix=v
@@ -120,7 +118,6 @@ jobs:
120118
with:
121119
images: cogstacksystems/jupyter-hub
122120
tags: |
123-
124121
# vX.Y.Z -> X.Y.Z and X.Y (strip "v")
125122
type=semver,pattern={{version}},prefix=v
126123
type=semver,pattern={{major}}.{{minor}},prefix=v
@@ -137,7 +134,6 @@ jobs:
137134
with:
138135
images: cogstacksystems/jupyter-singleuser
139136
tags: |
140-
141137
# vX.Y.Z -> X.Y.Z and X.Y (strip "v")
142138
type=semver,pattern={{version}},prefix=v
143139
type=semver,pattern={{major}}.{{minor}},prefix=v
@@ -147,6 +143,7 @@ jobs:
147143
type=ref,event=branch,enable=${{ github.event_name != 'pull_request' }}
148144
# short sha
149145
type=sha,format=short
146+
150147

151148
- uses: docker/login-action@v3
152149
with:
@@ -203,7 +200,6 @@ jobs:
203200
with:
204201
images: cogstacksystems/jupyter-singleuser-gpu
205202
tags: |
206-
207203
# vX.Y.Z -> X.Y.Z and X.Y (strip "v")
208204
type=semver,pattern={{version}},prefix=v
209205
type=semver,pattern={{major}}.{{minor}},prefix=v
@@ -252,7 +248,6 @@ jobs:
252248
with:
253249
images: cogstacksystems/jupyter-hub
254250
tags: |
255-
256251
# vX.Y.Z -> X.Y.Z and X.Y (strip "v")
257252
type=semver,pattern={{version}},prefix=v
258253
type=semver,pattern={{major}}.{{minor}},prefix=v
@@ -269,7 +264,6 @@ jobs:
269264
with:
270265
images: cogstacksystems/jupyter-singleuser
271266
tags: |
272-
273267
# vX.Y.Z -> X.Y.Z and X.Y (strip "v")
274268
type=semver,pattern={{version}},prefix=v
275269
type=semver,pattern={{major}}.{{minor}},prefix=v
@@ -287,21 +281,22 @@ jobs:
287281
ARM64: ${{ needs.build-arm64.outputs.hub_digest }}
288282
run: |
289283
set -euo pipefail
284+
290285
# must have both digests
291286
if [ -z "${AMD64:-}" ] || [ -z "${ARM64:-}" ]; then
292287
echo "Missing hub digests (amd64='${AMD64:-}', arm64='${ARM64:-}')."
293288
exit 1
294289
fi
295290
296-
# stitch each tag from the hub meta
297291
while IFS= read -r ref; do
298292
[[ -z "$ref" ]] && continue
299-
img="${ref%%:*}"; tag="${ref#*:}"
293+
img="${ref%%:*}"
294+
tag="${ref#*:}"
300295
301-
# optional: refuse v-prefixed tags (defensive)
296+
# normalize: if tag starts with 'v', strip it (v2.0.9 -> 2.0.9)
302297
if [[ "$tag" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
303-
echo "Refusing to publish v-prefixed tag: $img:$tag"
304-
exit 1
298+
echo "normalize: $img:$tag -> $img:${tag#v}"
299+
tag="${tag#v}"
305300
fi
306301
307302
echo "⛵ ${img}:${tag}"
@@ -318,18 +313,25 @@ jobs:
318313
ARM64: ${{ needs.build-arm64.outputs.su_digest }}
319314
run: |
320315
set -euo pipefail
316+
321317
# must have both digests
322318
if [ -z "${AMD64:-}" ] || [ -z "${ARM64:-}" ]; then
323-
echo "Missing singleuser digests (amd64='${AMD64:-}', arm64='${ARM64:-}')."; exit 1
319+
echo "Missing singleuser digests (amd64='${AMD64:-}', arm64='${ARM64:-}')."
320+
exit 1
324321
fi
325-
# stitch each tag
322+
323+
# stitch each tag from the singleuser meta
326324
while IFS= read -r ref; do
327325
[[ -z "$ref" ]] && continue
328-
img="${ref%%:*}"; tag="${ref#*:}"
329-
# optional: assert we aren't accidentally using a v-prefixed tag
326+
img="${ref%%:*}"
327+
tag="${ref#*:}"
328+
329+
# normalize: if tag starts with 'v', strip it (v2.0.9 -> 2.0.9)
330330
if [[ "$tag" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]; then
331-
echo "Refuses to publish v-prefixed tag: $img:$tag"; exit 1
331+
echo "normalize: $img:$tag -> $img:${tag#v}"
332+
tag="${tag#v}"
332333
fi
334+
333335
echo "⛵ ${img}:${tag}"
334336
docker buildx imagetools create \
335337
--tag "${img}:${tag}" \

0 commit comments

Comments
 (0)