ci(release): move :latest to the highest pre-release while no stable release exists

Only pre-releases (v0.1.0-rc.1, rc.2) are published, and :latest followed the highest stable release only, so the
Unraid template and the compose file, which pull :latest, found no image while :nightly was pushed every night.

The new Chronos.Tools command release-channels reads the published releases (stable and pre-releases), ignores drafts
and tags that are not SemVer, counts the tag itself as published and compares by SemVer 2.0 precedence. It prints
latest (the public releases repository: highest stable release only) and image_latest (:latest: the highest stable
release, or the highest pre-release while none is stable). Re-publishing an older tag never rolls either back.
release.yml uses it in place of curl|grep|sort -V; the image job pushes :latest on image_latest. README, the public
README, the compose file and ARCHITECTURE explain :latest, :<version> and :nightly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-26 21:45:57 +01:00
1 parent 5209579631
commit 3679e80ebb
8 files changed
+343 -31

No files matched your search

+22 -17
View File
@@ -1,9 +1,10 @@
name: Release
# A tag vMAJOR.MINOR.PATCH[-PRERELEASE] builds, tests and publishes everything (BRIEF §19.3, amended 2026-10-23, R3)
# A tag vMAJOR.MINOR.PATCH[-PRERELEASE] builds, tests and publishes everything (BRIEF §19.3, amended 2026-10-26, R1)
# on the Linux runner: the Windows programs cross-compiled (installers, portable and server zips), SHA256SUMS and
# release notes on the Gitea release, then the server image in the Gitea container registry. Pre-releases get no
# :latest image and are ignored by the in-app update check.
# release notes on the Gitea release, then the server image in the Gitea container registry. The image's :latest
# follows the highest stable release, or the highest pre-release while no stable one exists; the public releases
# repository and the in-app update check follow stable releases only.
on:
push:
tags: ["v*"]
@@ -48,6 +49,7 @@ jobs:
outputs:
version: ${{ steps.version.outputs.version }}
latest: ${{ steps.publish.outputs.latest }}
image_latest: ${{ steps.publish.outputs.image_latest }}
steps:
- name: Version
id: version
@@ -191,16 +193,18 @@ jobs:
if [ "$TARGET" != "${{ github.repository }}" ]; then token="$RELEASES_TOKEN"; fi
GITEA_TOKEN="$token" dotnet "$TOOLS" gitea-release --server "${{ github.server_url }}" --repo "$TARGET" --tag "$TAG" \
--title "Chronos $VERSION" --notes-file out/release-notes.md --assets out/release --prerelease "$PRERELEASE"
# The public content and the image's :latest follow the highest stable version (not Gitea's "latest", which
# is the most recently created one): re-publishing an older tag or publishing a pre-release never rolls them back.
stable="$(curl -fsS -H "Authorization: token $token" "${{ github.server_url }}/api/v1/repos/$TARGET/releases?draft=false&pre-release=false&limit=50")"
newest="$(printf '%s' "$stable" | grep -o '"tag_name":"v[^"]*"' | cut -d '"' -f 4 | sed 's/^v//' | sort -V | tail -n 1 || true)"
newest="${newest:+v$newest}"
latest=false
if [ "$PRERELEASE" = "false" ] && [ "$newest" = "$TAG" ]; then latest=true; fi
echo "Newest stable release of $TARGET: ${newest:-none}; $TAG moves the public content and :latest: $latest"
echo "latest=$latest" >> "$GITHUB_OUTPUT"
echo "LATEST=$latest" >> "$GITHUB_ENV"
# What this tag moves, by SemVer precedence among all published releases (not Gitea's "latest", which is the
# most recently created one), so re-publishing an older tag never rolls a channel back. latest: the public
# content follows the highest stable release. image_latest: :latest follows it too, or the highest pre-release
# while no stable release exists, so compose and Unraid users find an image from the first pre-release on.
releases="$RUNNER_TEMP/releases.json"
curl -fsS -H "Authorization: token $token" -o "$releases" "${{ github.server_url }}/api/v1/repos/$TARGET/releases?draft=false&limit=50"
channels="$(dotnet "$TOOLS" release-channels --tag "$TAG" --releases "$releases")"
latest="$(printf '%s\n' "$channels" | sed -n 's/^latest=//p')"
image_latest="$(printf '%s\n' "$channels" | sed -n 's/^image_latest=//p')"
echo "Releases of $TARGET: $TAG moves the public content: $latest; :latest: $image_latest"
{ echo "latest=$latest"; echo "image_latest=$image_latest"; } >> "$GITHUB_OUTPUT"
{ echo "LATEST=$latest"; echo "IMAGE_LATEST=$image_latest"; } >> "$GITHUB_ENV"
# Only with a separate releases repository (RELEASES_REPO and RELEASES_TOKEN, BRIEF §19.4): its README, EULA,
# security policy, issue forms, Unraid template, compose file, i18n/ and SHA256SUMS follow the newest stable
@@ -264,7 +268,7 @@ jobs:
timeout-minutes: 60
env:
VERSION: ${{ needs.release.outputs.version }}
LATEST: ${{ needs.release.outputs.latest }}
IMAGE_LATEST: ${{ needs.release.outputs.image_latest }}
steps:
- name: Checkout
env:
@@ -295,12 +299,13 @@ jobs:
run: |
docker build -f deploy/docker/Dockerfile --build-arg CHRONOS_VERSION="$VERSION" -t "$IMAGE:$VERSION" .
docker push "$IMAGE:$VERSION"
# Compose and Unraid users follow :latest: it moves only to the newest stable release.
if [ "$LATEST" = "true" ]; then
# Compose and Unraid users follow :latest: the highest stable release, or the highest pre-release while no
# stable release exists (release-channels). :nightly (docker.yml) is the nightly build of main, never a release.
if [ "$IMAGE_LATEST" = "true" ]; then
docker tag "$IMAGE:$VERSION" "$IMAGE:latest"
docker push "$IMAGE:latest"
fi
echo "Image: $IMAGE:$VERSION$([ "$LATEST" = "true" ] && echo " and :latest")"
echo "Image: $IMAGE:$VERSION$([ "$IMAGE_LATEST" = "true" ] && echo " and :latest")"
- name: Clean up
if: always()