ci: only main's newest commit moves latest-main (#24)
Two merges close together can build out of order: on 2026-11-19, #22's image job finished two minutes after #23's and moved `:latest-main` back to #22's build, so staging ran without the OpenID provider. Now a main push tags `:main-<commit>` always, and `:latest-main` only if its commit is still main's newest (`git ls-remote origin refs/heads/main`). Whichever finishes last, `:latest-main` ends on the newest commit. Tags (`vX.Y.Z`) are unchanged. t5de-catalog and t5de-site have the same line, and need the same fix. Two merges close together can build out of order: on 2026-11-19, #22's image job finished two minutes after #23's and moved `:latest-main` back to #22's build, so staging ran without the OpenID provider. Now a main push tags `:main-<commit>` always, and `:latest-main` only if its commit is still main's newest (`git ls-remote origin refs/heads/main`). Whichever finishes last, `:latest-main` ends on the newest commit. Tags (`vX.Y.Z`) are unchanged. t5de-catalog and t5de-site have the same line, and need the same fix. Co-authored-by: dhkatz <[email protected]>
This commit was merged in pull request #24.
This commit is contained in:
1 parent
df42b7833a
commit
d0f7e4d8c3
1 file changed
+5
-1
@@ -55,7 +55,11 @@ jobs:
|
|||||||
DOCKERFILE: ${{ matrix.dockerfile }}
|
DOCKERFILE: ${{ matrix.dockerfile }}
|
||||||
run: |
|
run: |
|
||||||
case "$GITHUB_REF" in
|
case "$GITHUB_REF" in
|
||||||
refs/heads/main) version="main-${GITHUB_SHA::12}"; tags="latest-main $version" ;;
|
refs/heads/main)
|
||||||
|
version="main-${GITHUB_SHA::12}"; tags="$version"
|
||||||
|
# Merges close together can finish out of order: only main's newest commit moves latest-main (staging).
|
||||||
|
if [ "$(git ls-remote origin refs/heads/main | cut -f1)" = "$GITHUB_SHA" ]; then tags="latest-main $tags"
|
||||||
|
else echo "main has moved on since this commit: :$version only, latest-main stays"; fi ;;
|
||||||
refs/tags/v*)
|
refs/tags/v*)
|
||||||
version="${GITHUB_REF#refs/tags/v}"
|
version="${GITHUB_REF#refs/tags/v}"
|
||||||
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Not a vX.Y.Z tag: no image"; exit 0; }
|
[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "Not a vX.Y.Z tag: no image"; exit 0; }
|
||||||
|
|||||||
Reference in new issue
Block a user