diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b0fb2e0f..4cba851fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -367,10 +367,15 @@ jobs: TAG: ${{ needs.decide.outputs.tag }} run: | signature=(); [[ -f dist/SHA256SUMS.sig ]] && signature=(dist/SHA256SUMS.sig) - # The release and the latest at once: there is one channel (docs/release-flow.md). + # The release and the latest at once: there is one channel (docs/release-flow.md). Each archive gets a + # label (file#label), which GitHub's page shows instead of the file name, so nobody takes the game's + # files for the download (#1647). Launchers, servers and install.sh match the name, which stays. gh release create "$TAG" --target "${{ needs.decide.outputs.head }}" --title "$(cat notes/title.txt)" \ - --notes-file notes/body.md --latest dist/horizon-linux-x86_64.tar.gz \ - dist/horizon-windows-x64.zip dist/horizon-macos-arm64.zip dist/horizon-server-linux-x86_64.tar.gz \ + --notes-file notes/body.md --latest \ + "dist/horizon-linux-x86_64.tar.gz#Game files the launcher installs: Linux (horizon-linux-x86_64.tar.gz)" \ + "dist/horizon-windows-x64.zip#Game files the launcher installs: Windows (horizon-windows-x64.zip)" \ + "dist/horizon-macos-arm64.zip#Game files the launcher installs: macOS (horizon-macos-arm64.zip)" \ + "dist/horizon-server-linux-x86_64.tar.gz#Dedicated server for Linux (horizon-server-linux-x86_64.tar.gz)" \ dist/SHA256SUMS "${signature[@]}" dist/smoke-test.json - name: Dry run, the release that would be published if: needs.decide.outputs.dry_run == 'true' diff --git a/docs/release-flow.md b/docs/release-flow.md index 758f254ee..4fb0209d9 100644 --- a/docs/release-flow.md +++ b/docs/release-flow.md @@ -312,6 +312,15 @@ and by hand; pushes to `launcher` and `launcher-*` branches only build. - Published with `--latest=false`: the repository's latest release stays a game release. Notes list the pull requests under New and Fixed; Kira posts launcher releases without pinging. +Making a launcher release GitHub's latest instead would break servers: every `horizon-server` already installed, +`install.sh` and `install.ps1` ask for `releases/latest` and expect the game's archives there, and a server that +can't update can't fetch the fix either. So the game release stays the latest, and it sends people to the launcher +(#1647): its notes open with a "Want to play? Download the Horizon launcher" block (`PLAYERS` in +`tools/release_train.py`: raw HTML, which GitHub shows and launchers' notes skip; the site's Releases page leaves +it out too), and its archives carry labels ("Game files the +launcher installs: Linux (…)") that GitHub shows in place of the file names. Everything that downloads matches +the asset's name, which is unchanged. + Starting by hand, pausing and rolling back work as for the game (`gh workflow run launcher …`, `RELEASES_PAUSED`, `gh release edit launcher@X.Y.Z --draft`). Launchers older than the withdrawn release then see the previous one as the newest; launchers that already updated keep running. diff --git a/tests/test_release_train.py b/tests/test_release_train.py index dde734c7d..56064fa42 100644 --- a/tests/test_release_train.py +++ b/tests/test_release_train.py @@ -106,16 +106,18 @@ class ReleaseTrainTests(unittest.TestCase): def test_the_first_release_of_0_2_says_what_changed(self): title, body = train.notes("game", "v0.2.0", [pr(1)], [], previous="v2026.10.21") self.assertTrue(title.startswith("Horizon 0.2.0: "), title) + body = body.removeprefix(train.PLAYERS + "\n\n") self.assertTrue(body.startswith("Horizon is numbered from now on: this is Horizon 0.2.0, the release after 2026.10.21.")) self.assertIn("`horizon-server update --version v0.2.0`", body) title, body = train.notes("launcher", "launcher@0.2.0", [], [], previous="launcher-v0.17.0") self.assertEqual(title, "Horizon launcher 0.2.0") self.assertIn("the release after launcher 0.17.0", body) self.assertIn("Rebuilt from the latest main.", body) - self.assertTrue(train.notes("game", "v0.3.0", [pr(1)], [], previous="v0.2.14")[1].startswith("The first release of Horizon 0.3.")) + body = train.notes("game", "v0.3.0", [pr(1)], [], previous="v0.2.14")[1] + self.assertTrue(body.startswith(train.PLAYERS + "\n\nThe first release of Horizon 0.3.")) for version, previous in [("v0.2.1", "v0.2.0"), ("v0.3.0-rc.1", "v0.2.9"), ("v2026.10.23", "v2026.10.21")]: body = train.notes("game", version, [pr(1)], [], previous=previous)[1] - self.assertTrue(body.startswith("### Fixed"), (version, body)) + self.assertTrue(body.startswith(train.PLAYERS + "\n\n### Fixed"), (version, body)) def test_decision(self): minute = dt.timedelta(minutes=1) @@ -201,6 +203,18 @@ class ReleaseTrainTests(unittest.TestCase): self.assertEqual(title, "Horizon launcher 0.2.0") self.assertIn("### Fixed\n- Launcher: say the self-update succeeded (#3)", body) self.assertNotIn("Known issues", body) + self.assertNotIn(train.PLAYERS, body) + self.assertIn("Your launcher updates itself.", body) + + def test_a_game_release_opens_with_the_way_to_the_launcher(self): + # GitHub's latest is a game release: whoever lands on it is sent to the launcher first (#1647). + _, body = train.notes("game", "v0.2.50", [pr(1)], ["- Sound cuts out after an hour."]) + self.assertTrue(body.startswith('

Want to play? Download the Horizon launcher')) + self.assertIn('href="https://github.com/ludovic111/horizon/releases?q=launcher&expanded=true"', body) + self.assertNotIn("\n", train.PLAYERS, "one line: one HTML block, which ends at the blank line after it") + self.assertEqual(body.count("playhorizon.dev"), 1, "said once, at the top") + _, body = train.notes("game", "v0.2.51", [], []) + self.assertTrue(body.startswith(train.PLAYERS + "\n\nRebuilt from the latest main.")) def test_known_issues_are_the_bullets_of_the_file(self): with tempfile.TemporaryDirectory() as temp: diff --git a/tools/release_train.py b/tools/release_train.py index 6ec2739d9..48d4d46cf 100644 --- a/tools/release_train.py +++ b/tools/release_train.py @@ -74,12 +74,17 @@ LAUNCHER_PATHS = [ ] LAUNCHER_IGNORED = ["launcher/links.json", "launcher/docs/", "launcher/tests/"] -FOOTER = { - "game": "Install or update it from the Horizon launcher: it installs new versions by itself. " - "New here? Get the launcher at https://playhorizon.dev. You need your own copy of Minecraft: Java Edition.", - "launcher": "Your launcher updates itself. New here? Download the archive for your system below, extract it, " - "and run `horizon-launcher`. Website: https://playhorizon.dev", -} +# A game release is GitHub's latest (servers and install.sh follow it), so it is the first release people land on: +# its notes open with the way to the launcher (#1647). Raw HTML on one line, which GitHub shows and every launcher's +# notes view and one-line summary skip (pulldown-cmark's HTML events), so launchers never tell players to get +# themselves. The site's Releases page leaves it out too. +PLAYERS = ('

Want to play? Download the Horizon launcher, not the files ' + 'below

It installs this version and keeps it up to date. It is also on GitHub: the launcher releases. You need your ' + "own copy of Minecraft: Java Edition. The files below are what the launcher installs, and the dedicated " + "server for people who host one.

") +LAUNCHER_FOOTER = ("Your launcher updates itself. New here? Download the archive for your system below, extract it, " + "and run `horizon-launcher`. Website: https://playhorizon.dev") DISCLAIMER = "Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft." # An open issue with this label holds every game release (docs/release-flow.md). Only people who can triage the # repository can add it, and the issue's text is never read: its author could edit it afterwards. @@ -374,7 +379,9 @@ def notes(kind, version, prs, issues, previous=None): else: title = f"Horizon launcher {version.removeprefix(OLD_LAUNCHER_PREFIX).removeprefix(LAUNCHER_PREFIX)}" intro = line_intro(kind, version, previous) - parts = [intro] if intro else [] + parts = [PLAYERS] if kind == "game" else [] + if intro: + parts.append(intro) if not shown: parts.append("Rebuilt from the latest main.") if new: @@ -386,7 +393,8 @@ def notes(kind, version, prs, issues, previous=None): contributors = sorted({pr["author"] for pr in shown if pr["author"] and pr["author"] != REPO.split("/")[0]}) if contributors: parts.append("Thanks to " + ", ".join(f"@{name}" for name in contributors) + ".") - parts.append(FOOTER[kind]) + if kind == "launcher": + parts.append(LAUNCHER_FOOTER) parts.append(DISCLAIMER) return title, "\n\n".join(parts) + "\n" diff --git a/website/src/releases.js b/website/src/releases.js index de59c8fef..d4932e7f7 100644 --- a/website/src/releases.js +++ b/website/src/releases.js @@ -50,8 +50,12 @@ export function sections(body) { // An item without its pull request references: "Riptide (#123, fixes #45)" -> "Riptide". export const plainItem = (item) => item.replace(/\s*\((?:#\d+|fixes #\d+|[^()]*#\d+[^()]*)\)\s*/g, " ").replace(/\s+/g, " ").trim(); +// A game release's notes open with an HTML block sending people to the launcher (PLAYERS in tools/release_train.py): +// GitHub's latest release is the game's. This site has its own download button, so it leaves the block out. +export const notesText = (body) => (body || "").replace(/^

Want to play\?[^\n]*(?:\r?\n)*/, ""); + // The notes' first sentence, for a release with no title line and no sections ("Rebuilt from the latest main."). -const firstLine = (body) => ((body || "").split(/\r?\n/).find((l) => l.trim() && !/^#/.test(l)) || "").trim().replace(/[.:]$/, ""); +const firstLine = (body) => (notesText(body).split(/\r?\n/).find((l) => l.trim() && !/^#/.test(l)) || "").trim().replace(/[.:]$/, ""); const count = (n, one, many) => `${n} ${n === 1 ? one : many}`; @@ -135,7 +139,7 @@ function releaseHtml(r, open) { ${o.text ? `

${escape(o.text)}

` : ""} ${top.length ? `` : ""} ` : ""} -
${markdown(r.body || "") || "

No notes for this release.

"}
+
${markdown(notesText(r.body)) || "

No notes for this release.

"}
${downloads ? `

Downloads

` : ""}

This release on GitHub

diff --git a/website/src/releases.test.mjs b/website/src/releases.test.mjs new file mode 100644 index 000000000..acd1a0965 --- /dev/null +++ b/website/src/releases.test.mjs @@ -0,0 +1,13 @@ +// node --test src/: the release notes as the site shows them. +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { notesText } from "./releases.js"; + +const players = '

Want to play? Download the Horizon launcher, not the files below

It installs this version.

'; + +test("the block sending people to the launcher is left out, the notes stay", () => { + assert.equal(notesText(`${players}\n\n### Fixed\n- A fix (#1)\n`), "### Fixed\n- A fix (#1)\n"); + assert.equal(notesText(`${players}\r\n\r\nRebuilt from the latest main.\r\n`), "Rebuilt from the latest main.\r\n"); + assert.equal(notesText("

Other HTML

\n\n### New\n- A thing (#2)\n"), "

Other HTML

\n\n### New\n- A thing (#2)\n"); + assert.equal(notesText(undefined), ""); +});