From 411425b83abafdac85d569d22b43ea1afdeb36a0 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 3 Oct 2026 10:07:18 +0000 Subject: [PATCH] ci(release): push the image only after the tests, move :latest after the release - The docker job waits for the Windows build and tests and pushes only :; publish moves :latest with imagetools once the GitHub release exists and the tag is the newest stable one, so a failed or older re-published tag never moves it. - The GitHub release is created before the public repository content, so the public SHA256SUMS never describes a release that does not exist. - Stable release notes start from the previous stable tag. - Raw links to the public repository follow its default branch. - Public README and bug form name the Diagnostics row and its button. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- .github/workflows/release.yml | 73 ++++++++++++------- README.md | 20 ++--- .../.github/ISSUE_TEMPLATE/bug_report.yml | 4 +- deploy/releases-repo/README.md | 7 +- 4 files changed, 64 insertions(+), 40 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08d0e962..59a68f85 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -157,7 +157,12 @@ jobs: env: TAG: ${{ needs.version.outputs.tag }} run: | - previous="$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true)" + # A stable release lists everything since the previous stable one, not only what followed its last pre-release. + if [[ "$TAG" == *-* ]]; then + previous="$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || true)" + else + previous="$(git describe --tags --abbrev=0 --exclude '*-*' "$TAG^" 2>/dev/null || true)" + fi range="${previous:+$previous..}$TAG" git log --no-merges --format='%h%x09%s' "$range" | dotnet "$TOOLS" changelog --title "Titano $VERSION" --out out/release-notes.md cat out/release-notes.md @@ -171,8 +176,10 @@ jobs: out/release-notes.md out/screenshots/ + # Pushes only the version tag, and only after the Windows job's tests passed; publish moves :latest once the GitHub + # release exists and the tag is the newest stable one. docker: - needs: version + needs: [version, windows] runs-on: ubuntu-latest outputs: image: ${{ steps.image.outputs.name }} @@ -197,9 +204,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: TITANO_VERSION=${{ needs.version.outputs.version }} - tags: | - ${{ steps.image.outputs.name }}:${{ needs.version.outputs.version }} - ${{ needs.version.outputs.prerelease == 'false' && format('{0}:latest', steps.image.outputs.name) || '' }} + tags: ${{ steps.image.outputs.name }}:${{ needs.version.outputs.version }} cache-from: type=gha cache-to: type=gha,mode=max @@ -243,8 +248,9 @@ jobs: repo="$GITHUB_REPOSITORY" echo "::notice title=Release::RELEASES_TOKEN is not set: publishing to $GITHUB_REPOSITORY instead of $RELEASES_REPO (clients only see releases of $RELEASES_REPO)." fi - # The public content (README, EULA, i18n/, SHA256SUMS) follows the newest stable release, so re-publishing an - # older tag or publishing a pre-release never rolls it back; until a stable release exists, every tag updates it. + # The public content (README, EULA, i18n/, SHA256SUMS), the GitHub "Latest" marker and the image's :latest tag + # follow the newest stable release, so re-publishing an older tag or publishing a pre-release never rolls them + # back; until a stable release exists, every tag updates the public content. latest="$(gh release view --repo "$repo" --json tagName --jq .tagName 2>/dev/null || true)" newest=true if [ -n "$latest" ] && [ "$latest" != "$TAG" ]; then @@ -254,7 +260,7 @@ jobs: fi echo "Latest release of $repo: ${latest:-none}; $TAG is the newest: $newest" if [ "$newest" = "false" ]; then - echo "::notice title=Release::$TAG is older than $latest or a pre-release: the public repository content is left as it is." + echo "::notice title=Release::$TAG is older than $latest or a pre-release: the public repository content and :latest are left as they are." fi { echo "repo=$repo" @@ -264,6 +270,35 @@ jobs: - name: Validate the public issue forms run: ruby .github/scripts/check-yaml.rb deploy/releases-repo/.github/ISSUE_TEMPLATE/*.yml + - name: GitHub release + env: + GH_TOKEN: ${{ env.HAS_RELEASES_TOKEN == 'true' && secrets.RELEASES_TOKEN || secrets.GITHUB_TOKEN }} + TARGET: ${{ steps.target.outputs.repo }} + NEWEST: ${{ steps.target.outputs.newest }} + run: | + # An older stable tag published again must not become "Latest" (the update check reads releases/latest). + latest=() + if [ "$PRERELEASE" = "false" ] && [ "$NEWEST" = "false" ]; then latest=(--latest=false); fi + if gh release view "$TAG" --repo "$TARGET" > /dev/null 2>&1; then + gh release upload "$TAG" out/release/* --repo "$TARGET" --clobber + gh release edit "$TAG" --repo "$TARGET" --title "Titano $VERSION" --notes-file out/release-notes.md --prerelease="$PRERELEASE" "${latest[@]}" + else + gh release create "$TAG" out/release/* --repo "$TARGET" --title "Titano $VERSION" --notes-file out/release-notes.md --prerelease="$PRERELEASE" "${latest[@]}" + fi + + - uses: docker/setup-buildx-action@v3 + if: env.PRERELEASE == 'false' && steps.target.outputs.newest == 'true' + - uses: docker/login-action@v3 + if: env.PRERELEASE == 'false' && steps.target.outputs.newest == 'true' + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Move the image's latest tag + if: env.PRERELEASE == 'false' && steps.target.outputs.newest == 'true' + # Compose and Unraid users follow :latest; it moves only once the release exists, never back to an older server. + run: docker buildx imagetools create --tag "$IMAGE:latest" "$IMAGE:$VERSION" + - name: Update the public releases repository if: env.HAS_RELEASES_TOKEN == 'true' && steps.target.outputs.newest == 'true' env: @@ -286,7 +321,8 @@ jobs: done # Links in the published files follow the configured repository and the image the docker job pushed. find public -path public/.git -prune -o -type f \( -name '*.md' -o -name '*.yml' -o -name '*.xml' \) -print0 | - xargs -0 -r sed -i -e "s#alby96/titano-releases#${RELEASES_REPO}#g" -e "s#ghcr.io/alby96/titano-server#${IMAGE}#g" + xargs -0 -r sed -i -e "s#alby96/titano-releases/main/#${RELEASES_REPO}/${branch}/#g" -e "s#alby96/titano-releases#${RELEASES_REPO}#g" \ + -e "s#ghcr.io/alby96/titano-server#${IMAGE}#g" cd public git config user.name "titano-release" git config user.email "titano-release@users.noreply.github.com" @@ -298,30 +334,15 @@ jobs: git push origin "HEAD:$branch" fi - - name: GitHub release - env: - GH_TOKEN: ${{ env.HAS_RELEASES_TOKEN == 'true' && secrets.RELEASES_TOKEN || secrets.GITHUB_TOKEN }} - TARGET: ${{ steps.target.outputs.repo }} - NEWEST: ${{ steps.target.outputs.newest }} - run: | - # An older stable tag published again must not become "Latest" (the update check reads releases/latest). - latest=() - if [ "$PRERELEASE" = "false" ] && [ "$NEWEST" = "false" ]; then latest=(--latest=false); fi - if gh release view "$TAG" --repo "$TARGET" > /dev/null 2>&1; then - gh release upload "$TAG" out/release/* --repo "$TARGET" --clobber - gh release edit "$TAG" --repo "$TARGET" --title "Titano $VERSION" --notes-file out/release-notes.md --prerelease="$PRERELEASE" "${latest[@]}" - else - gh release create "$TAG" out/release/* --repo "$TARGET" --title "Titano $VERSION" --notes-file out/release-notes.md --prerelease="$PRERELEASE" "${latest[@]}" - fi - - name: Summary env: TARGET: ${{ steps.target.outputs.repo }} + NEWEST: ${{ steps.target.outputs.newest }} run: | { echo "## Titano $VERSION" echo "- Release: https://github.com/$TARGET/releases/tag/$TAG" - echo "- Image: \`$IMAGE:$VERSION\`$([ "$PRERELEASE" = "false" ] && echo " and \`:latest\`")" + echo "- Image: \`$IMAGE:$VERSION\`$([ "$PRERELEASE" = "false" ] && [ "$NEWEST" = "true" ] && echo " and \`:latest\`")" echo "- GHCR packages are private when first pushed and GitHub has no API to change that: once, open the" echo " package settings of \`titano-server\` and set its visibility to **Public** (BRIEF §19.4)." echo diff --git a/README.md b/README.md index f5e94288..4a3160d7 100644 --- a/README.md +++ b/README.md @@ -73,12 +73,14 @@ The server reads `/data/server.json` (`TITANO_DATA_PATH`) and `TITANO_*` environ - publishes self-contained single-file programs, signs them when signing secrets exist, packs `Titano-Setup-.exe` and `Titano-Uploader-Setup-.exe` (`Titano.Tools pack-installer`), signs the setups, zips `Titano-Server-win-x64-.zip` and `Titano-win-x64-portable-.zip`; - - writes release notes from the Conventional Commits since the previous tag (`Titano.Tools changelog`); - - builds and pushes `ghcr.io//titano-server:` (and `:latest` for stable tags) for amd64 and arm64; - - computes `SHA256SUMS`, checks the public issue forms, updates the public releases repository and creates (or - updates) the GitHub release there. The repository content (README, EULA, `i18n/`, `SHA256SUMS`) follows the - newest stable release: a pre-release, or an older tag published again, only gets its release and never becomes - *Latest*. Until the first stable release exists, every tag updates the content. + - writes release notes from the Conventional Commits since the previous tag (`Titano.Tools changelog`); a stable + tag starts from the previous stable tag, so its notes include what its release candidates brought; + - once the Windows tests passed, builds and pushes `ghcr.io//titano-server:` for amd64 and arm64; + - computes `SHA256SUMS`, checks the public issue forms, creates (or updates) the GitHub release in the public + repository, then moves the image's `:latest` tag and updates the public repository content (README, EULA, + `i18n/`, `SHA256SUMS`). `:latest`, *Latest* and the content follow the newest stable release: a pre-release, or + an older tag published again, only gets its release and its `:` image. Until the first stable release exists, + every tag updates the content. 4. To publish an existing tag again (for example after adding a secret), run *Release* manually with the tag. ### Secrets and variables @@ -90,7 +92,7 @@ The server reads `/data/server.json` (`TITANO_DATA_PATH`) and `TITANO_*` environ | `SIGN_PFX_BASE64` | secret (optional) | Base64 of the Authenticode code-signing certificate (`.pfx`). Without it builds are unsigned. | | `SIGN_PASSWORD` | secret (optional) | Password of that `.pfx`. | -`GITHUB_TOKEN` pushes the image to GHCR; no other secret is used. +`GITHUB_TOKEN` pushes the image to GHCR and moves its `:latest` tag; no other secret is used. ### Bootstrapping the public releases repository @@ -100,8 +102,8 @@ The server reads `/data/server.json` (`TITANO_DATA_PATH`) and `TITANO_*` environ it as the `RELEASES_TOKEN` secret of this repository. 3. Push a pre-release tag (`v0.1.0-rc.1`). The release job copies `deploy/releases-repo/` (README, EULA draft, SECURITY policy, issue forms), the Unraid template and its icon, the compose file and `.env.example`, the dark - screenshots, `i18n/` and the latest `SHA256SUMS` into the public repository, rewriting links to its name, then - creates the release with the installers. + screenshots, `i18n/` and the latest `SHA256SUMS` into the public repository after creating the release with the + installers, rewriting links to its name and default branch. 4. After the first image push, open the `titano-server` package on GHCR › *Package settings* and set its visibility to **Public** (GitHub offers no API for this; the release summary reminds you). 5. Have the EULA draft (`deploy/releases-repo/EULA.md`) reviewed before the first stable release. diff --git a/deploy/releases-repo/.github/ISSUE_TEMPLATE/bug_report.yml b/deploy/releases-repo/.github/ISSUE_TEMPLATE/bug_report.yml index 7744468d..770d90b9 100644 --- a/deploy/releases-repo/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/deploy/releases-repo/.github/ISSUE_TEMPLATE/bug_report.yml @@ -53,8 +53,8 @@ body: attributes: label: Diagnostics description: | - Desktop: Settings › Advanced › *Export bundle*, then drag the zip here. Server: admin panel › Logs › - *Diagnostics*. Bundles contain logs and system information, never photos, passwords or tokens; read them + Desktop: Settings › Advanced › Diagnostics › *Export bundle* (or About › *Diagnostics bundle*), then drag the + zip here. Server: admin panel › Logs › *Diagnostics*. Bundles contain logs and system information, never photos, passwords or tokens; read them before sharing if your folder or host names are private. - type: checkboxes id: checks diff --git a/deploy/releases-repo/README.md b/deploy/releases-repo/README.md index 0d0414ea..19fcefa7 100644 --- a/deploy/releases-repo/README.md +++ b/deploy/releases-repo/README.md @@ -105,13 +105,14 @@ your proposal — or the in-app *Suggest a fix* link in About, which leads here. ## Verifying downloads Every release carries `SHA256SUMS`. On Linux or macOS: `sha256sum -c SHA256SUMS --ignore-missing`. Titano's -in-app update download performs the same check before showing the setup. Signed builds carry an Authenticode +in-app update download performs the same check before showing the setup or portable zip. Signed builds carry an Authenticode signature; unsigned builds may show a SmartScreen prompt. ## Support and security -- Bugs: open a **Bug report** issue (attach the diagnostics bundle from Settings › Advanced › *Export bundle*; it - contains logs and system information, never photos, passwords or tokens). +- Bugs: open a **Bug report** issue (attach the diagnostics bundle from Settings › Advanced › Diagnostics › + *Export bundle*, or the server's from admin panel › Logs › *Diagnostics*; it contains logs and system information, + never photos, passwords or tokens). - Security problems: see [SECURITY.md](SECURITY.md) — please do not open public issues for them. ## Licence