ci: keep prereleases off the latest tag

`release: published` fires for prereleases too, and every manifest job pushed
`latest` unconditionally, so publishing a release candidate by hand would have
made it the image everyone pulls. The backend image had the same hole, so fix
all three rather than only the two added here.

A release the backend-release workflow calls is always stable, so the
workflow_call path keeps moving `latest`; the release-event path moves it only
when the release is not a prerelease.
This commit is contained in:
Alex committed 2026-09-12 22:19:27 +01:00
1 parent 7dd59519be
commit c18e26f798
3 files changed
+18 -5

No files matched your search

+6 -2
View File
@@ -142,11 +142,15 @@ jobs:
- name: Create and push multi-arch manifests
env:
TAG: ${{ env.RELEASE_TAG }}${{ matrix.variant }}
LATEST: latest${{ matrix.variant }}
# A stable release moves `latest`; a prerelease published by hand
# moves only its own tag (the release trigger fires for those too).
LATEST: ${{ (inputs.version || !github.event.release.prerelease) && format('latest{0}', matrix.variant) || '' }}
run: |
set -e
# $LATEST is deliberately unquoted: it is empty for a prerelease, and
# an empty word would create a manifest named "$repo:".
for repo in "$DOCKERHUB_NAMESPACE/docsgpt" "ghcr.io/${{ github.repository_owner }}/docsgpt"; do
for name in "$TAG" "$LATEST"; do
for name in "$TAG" $LATEST; do
docker manifest create "$repo:$name" \
--amend "$repo:$TAG-amd64" \
--amend "$repo:$TAG-arm64"