Release channels: blockers hold every beta, latest only moves forward, a stalled promotion opens an issue
- A release-blocker issue's text is never read: its author can edit it after a maintainer labels it, so an open blocker holds every beta, and one closed as completed still holds the betas published before it closed. - Even --force never promotes a beta that isn't newer than the stable release: horizon-server update and install.sh download GitHub's latest. - When the oldest beta newer than the stable release has waited 24 hours, promote.yml opens a "Promotion to stable has stalled" issue with the last reason; the next promotion closes it. - promote.yml: persist-credentials: false; issues: write for the stall issue. - Website: the newest 100 releases, plus GitHub's latest (the stable one) when a day of betas pushes it out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,10 @@ name: promote
|
||||
# gh workflow run promote -f tag=v2026.10.19.03 # that beta now, without the wait
|
||||
# gh workflow run promote -f tag=v2026.10.19.03 -f force=true # even blocked or without its smoke test
|
||||
# gh workflow run promote -f dry_run=true # say what would be promoted
|
||||
# Holding a beta back: open (or label) an issue release-blocker that names its version; naming none holds them all.
|
||||
# Holding betas back: label an issue release-blocker. While it is open it holds every beta; closed as completed it
|
||||
# still holds the betas published before it closed. The issue's text is never read (its author could edit it).
|
||||
# When the oldest waiting beta is 24 hours old, an issue "Promotion to stable has stalled" says so; it closes itself
|
||||
# after the next promotion.
|
||||
on:
|
||||
schedule:
|
||||
- cron: '13,43 * * * *'
|
||||
@@ -25,7 +28,7 @@ on:
|
||||
default: false
|
||||
permissions:
|
||||
contents: write
|
||||
issues: read
|
||||
issues: write
|
||||
concurrency:
|
||||
group: promote
|
||||
cancel-in-progress: false
|
||||
@@ -38,6 +41,8 @@ jobs:
|
||||
with:
|
||||
# The notes of a promoted release cover every pull request since the last stable one.
|
||||
fetch-depth: 0
|
||||
# gh uses GH_TOKEN below; nothing needs git credentials on disk.
|
||||
persist-credentials: false
|
||||
- name: Promote
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
+13
-6
@@ -135,7 +135,7 @@ commits) since the last **published** game release:
|
||||
| `skip-release` | Doesn't trigger a release and isn't listed in the notes |
|
||||
| `run-parity` | Runs the parity job once on a fork's pull request |
|
||||
| `parity-regression` | Opened by the nightly audit for a harness that fails on main |
|
||||
| `release-blocker` | On an issue: holds the beta it names, and every later one, back from stable ([Channels](#channels)) |
|
||||
| `release-blocker` | On an issue: holds every beta back from stable while it is open ([Channels](#channels)) |
|
||||
|
||||
Pull requests without `feature` are listed under **Fixed**. Titles are written for players, since they become
|
||||
the notes.
|
||||
@@ -182,10 +182,17 @@ beta that
|
||||
- passed its release smoke test: the macOS build attaches `smoke-test.json` (the offscreen game run's report) only
|
||||
when the game drew a world on the Mac mini, so a release built while `MAC_RUNNER` sends macOS to GitHub waits
|
||||
for a hand,
|
||||
- and isn't covered by an issue labelled `release-blocker`. A blocker covers the beta whose version it names
|
||||
(`v2026.10.19.03` or `2026.10.19.3`, title or body) and every later one, or every beta when it names none,
|
||||
while it is open; closed as completed it still covers the betas published before it closed (they have the
|
||||
bug), closed as not planned it covers nothing. Issue text is only searched for versions.
|
||||
- and isn't covered by an issue labelled `release-blocker`. An open blocker holds every beta; closed as completed
|
||||
it still holds the betas published before it closed (they have the bug); closed as not planned it holds
|
||||
nothing. Only the label and the issue's state count, never its text: whoever opened the issue can edit the
|
||||
text after a maintainer labels it, so it can't pick which betas go out.
|
||||
|
||||
Nothing older than the stable release is ever promoted, not even with `force`: GitHub's latest release is what
|
||||
`horizon-server update` and `install.sh` download, so it only moves forward.
|
||||
|
||||
When the oldest beta newer than the stable release has waited 24 hours, promote.yml opens an issue titled
|
||||
"Promotion to stable has stalled" with the reason from the last check (a blocker left open, smoke tests not
|
||||
running). It closes itself after the next promotion.
|
||||
|
||||
Promoting marks the beta stable and latest and rewrites its notes to list everything since the previous stable
|
||||
release (`release_train.py notes --stable`), so players who skipped the betas see all of it. Older betas stay
|
||||
@@ -264,7 +271,7 @@ A bad release is withdrawn by turning it back into a draft:
|
||||
gh release edit v2026.10.15.01 --draft
|
||||
```
|
||||
|
||||
A beta that is not promoted yet needs no rollback: label an issue naming it `release-blocker`. For a stable
|
||||
A beta that is not promoted yet needs no rollback: label an issue about it `release-blocker`. For a stable
|
||||
release: launchers list only published releases, so the previous version becomes the newest one again, launchers that
|
||||
didn't install the bad one won't, and players who did can pick the previous version in the launcher's version
|
||||
list (`launcher/src/backend.rs` tests `withdrawn_release_is_never_offered`). The tag stays, so the next release
|
||||
|
||||
@@ -55,26 +55,43 @@ class ReleaseChannelTests(unittest.TestCase):
|
||||
older = release("v2026.10.18.03", 40)
|
||||
self.assertIsNone(channels.choose([STABLE, older], [], NOW)[0])
|
||||
|
||||
def test_a_blocker_holds_the_version_it_names_and_every_later_beta(self):
|
||||
def test_an_open_blocker_holds_every_beta_whatever_its_text_says(self):
|
||||
releases = [STABLE, release("v2026.10.19", 12), release("v2026.10.19.01", 10), release("v2026.10.19.02", 8)]
|
||||
chosen, _ = channels.choose(releases, [blocker(7, "Chests empty", "Since v2026.10.19.01 the chests…")], NOW)
|
||||
self.assertEqual(chosen["tag_name"], "v2026.10.19")
|
||||
|
||||
def test_a_blocker_naming_no_version_holds_every_beta(self):
|
||||
releases = [STABLE, release("v2026.10.19", 12)]
|
||||
self.assertIsNone(channels.choose(releases, [blocker(8, "Something is badly wrong")], NOW)[0])
|
||||
# The issue's author can edit its text after it is labelled: naming a later version must not free a beta.
|
||||
for text in ("Something is badly wrong", "Only in v2099.01.01", "Since v2026.10.19.01 the chests…"):
|
||||
chosen, why = channels.choose(releases, [blocker(7, text, body=text)], NOW)
|
||||
self.assertIsNone(chosen, text)
|
||||
self.assertIn("release-blocker #7", why)
|
||||
|
||||
def test_a_fixed_blocker_still_holds_the_betas_published_before_the_fix(self):
|
||||
fixed = blocker(9, "Crash in v2026.10.19", state="closed", reason="completed", closed_hours_ago=7.5)
|
||||
fixed = blocker(9, "Crash", state="closed", reason="completed", closed_hours_ago=7.5)
|
||||
releases = [STABLE, release("v2026.10.19", 12), release("v2026.10.19.01", 7)]
|
||||
self.assertEqual(channels.choose(releases, [fixed], NOW)[0]["tag_name"], "v2026.10.19.01")
|
||||
self.assertIsNone(channels.choose(releases[:2], [fixed], NOW)[0])
|
||||
not_planned = blocker(10, "Crash in v2026.10.19", state="closed", reason="not_planned", closed_hours_ago=1)
|
||||
not_planned = blocker(10, "Crash", state="closed", reason="not_planned", closed_hours_ago=1)
|
||||
self.assertEqual(channels.choose(releases[:2], [not_planned], NOW)[0]["tag_name"], "v2026.10.19")
|
||||
|
||||
def test_versions_people_write_in_issues(self):
|
||||
found = channels.mentioned_versions("v2026.10.19.03, 2026.10.18 and 2026.10.19.3; not Minecraft 1.21.10 or 26.3")
|
||||
self.assertEqual(found, {(2026, 10, 19, 3), (2026, 10, 18, 0)})
|
||||
def test_force_never_moves_latest_backwards(self):
|
||||
# horizon-server update and install.sh download GitHub's latest: an older beta must never become it.
|
||||
older = release("v2026.10.18.03", 40, smoke=False)
|
||||
chosen, why = channels.choose([STABLE, older], [blocker(3, "x")], NOW, tag="v2026.10.18.03", force=True)
|
||||
self.assertIsNone(chosen)
|
||||
self.assertIn("not newer than the stable v2026.10.18.04", why)
|
||||
same = release("v2026.10.18.04", 30, prerelease=False)
|
||||
self.assertIsNone(channels.choose([same], [], NOW, tag="v2026.10.18.04", force=True)[0])
|
||||
|
||||
def test_a_stall_is_reported_once_the_oldest_waiting_beta_is_a_day_old(self):
|
||||
self.assertIsNone(channels.stalled([STABLE, release("v2026.10.19", 23), release("v2026.10.19.01", 2)], NOW))
|
||||
releases = [STABLE, release("v2026.10.19", 25), release("v2026.10.19.01", 2)]
|
||||
oldest, age = channels.stalled(releases, NOW)
|
||||
self.assertEqual(oldest["tag_name"], "v2026.10.19")
|
||||
title, body = channels.stall_issue(releases, (oldest, age), "no beta is due (release-blocker #4)")
|
||||
self.assertEqual(title, "Promotion to stable has stalled: v2026.10.19 has waited 25 h")
|
||||
self.assertIn("v2026.10.18.04", body)
|
||||
self.assertIn("release-blocker #4", body)
|
||||
# Betas older than the stable release are contained in it: they aren't waiting.
|
||||
self.assertIsNone(channels.stalled([STABLE, release("v2026.10.18.03", 40)], NOW))
|
||||
self.assertIsNone(channels.stalled([STABLE], NOW))
|
||||
|
||||
def test_beta_notes_say_so_and_stable_notes_do_not(self):
|
||||
pr = {"number": 1, "title": "Fix a thing", "labels": [], "paths": ["crates/x.rs"], "issues": [], "author": "ludovic111"}
|
||||
|
||||
+65
-27
@@ -10,13 +10,18 @@ Every game release goes out as a beta (a GitHub pre-release). A beta is due for
|
||||
- it is newer than the stable release (GitHub's "latest", which launchers and servers install by default),
|
||||
- it has been out PROMOTE_AFTER (6 hours) without trouble; a promotion by hand (--tag) skips the wait,
|
||||
- its release smoke test passed: release.yml attaches smoke-test.json only after the Mac mini ran the game,
|
||||
- and no issue labelled release-blocker covers it. A blocker covers the betas from the version it names onwards
|
||||
(every beta when it names none), published while it is open; one closed as completed keeps covering the betas
|
||||
published before it closed (they still have the bug), one closed as not planned covers nothing.
|
||||
- and no issue labelled release-blocker covers it. An open blocker holds every beta; one closed as completed keeps
|
||||
holding the betas published before it closed (they still have the bug); one closed as not planned holds nothing.
|
||||
Only people who can triage the repository can add the label, and the issue's text is never read: whoever wrote
|
||||
the issue could edit it afterwards, so it can't decide which betas go out.
|
||||
|
||||
The newest due beta is promoted: marked stable and latest, with notes covering everything since the previous
|
||||
stable release (tools/release_train.py notes --stable). Older betas stay betas: the stable one contains them.
|
||||
Issue text is only searched for version numbers; it never changes what this does beyond blocking.
|
||||
Nothing older than the current stable release is ever promoted, even with --force: GitHub's "latest" is what
|
||||
horizon-server update and install.sh download, and it only moves forward.
|
||||
|
||||
When the oldest beta newer than the stable release has waited STALL_AFTER (24 hours), promotion has stalled
|
||||
(blocked, smoke tests not running, the schedule off): an issue says so, and is closed once a beta is promoted.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
@@ -34,17 +39,14 @@ REPO = os.environ.get("GITHUB_REPOSITORY", "ludovic111/horizon")
|
||||
PROMOTE_AFTER = dt.timedelta(hours=6)
|
||||
SMOKE_ASSET = "smoke-test.json"
|
||||
BLOCKER = "release-blocker"
|
||||
STALL_AFTER = dt.timedelta(hours=24)
|
||||
STALLED = "Promotion to stable has stalled"
|
||||
GAME_TAG = re.compile(r"v\d{4}\.\d{2}\.\d{2}(?:\.\d+)?")
|
||||
# A version as people write it in an issue: with or without the v, a day's counter padded or not.
|
||||
MENTION = re.compile(r"(?<![\w.])v?(\d{4})\.(\d{1,2})\.(\d{1,2})(?:\.(\d+))?(?!\w)")
|
||||
|
||||
|
||||
def tag_key(tag):
|
||||
"""A game tag's numbers, four of them (v2026.10.19 is (2026, 10, 19, 0)), so tags and mentions compare."""
|
||||
return padded(tuple(int(part) for part in re.findall(r"\d+", tag)))
|
||||
|
||||
|
||||
def padded(version):
|
||||
"""A game tag's numbers, four of them (v2026.10.19 is (2026, 10, 19, 0)), so tags compare."""
|
||||
version = tuple(int(part) for part in re.findall(r"\d+", tag))
|
||||
return version + (0,) * (4 - len(version))
|
||||
|
||||
|
||||
@@ -52,23 +54,12 @@ def parse_time(text):
|
||||
return dt.datetime.fromisoformat(text.replace("Z", "+00:00")) if text else None
|
||||
|
||||
|
||||
def mentioned_versions(text):
|
||||
"""The game versions an issue names, as tag keys ((2026, 10, 19, 3) for v2026.10.19.03)."""
|
||||
return {padded(tuple(int(part) for part in match.groups() if part is not None)) for match in MENTION.finditer(text or "")}
|
||||
|
||||
|
||||
def covers(blocker, release):
|
||||
"""Whether a release-blocker issue holds this beta back."""
|
||||
if blocker.get("state") == "closed":
|
||||
closed = parse_time(blocker.get("closed_at"))
|
||||
if blocker.get("state_reason") != "completed" or not closed:
|
||||
return False
|
||||
if parse_time(release["published_at"]) >= closed:
|
||||
return False
|
||||
versions = mentioned_versions(f"{blocker.get('title', '')}\n{blocker.get('body') or ''}")
|
||||
if not versions:
|
||||
"""Whether a release-blocker issue holds this beta back. Only its state and dates count, never its text."""
|
||||
if blocker.get("state") != "closed":
|
||||
return True
|
||||
return any(tag_key(release["tag_name"]) >= version for version in versions)
|
||||
closed = parse_time(blocker.get("closed_at"))
|
||||
return blocker.get("state_reason") == "completed" and bool(closed) and parse_time(release["published_at"]) < closed
|
||||
|
||||
|
||||
def stable(releases):
|
||||
@@ -107,7 +98,8 @@ def choose(releases, blockers, now, tag=None, force=False):
|
||||
return None, f"no published game release is tagged {tag}"
|
||||
reasons = reasons_against(release, current, blockers, now, by_hand=True)
|
||||
if force:
|
||||
reasons = [r for r in reasons if r == "it is already stable"]
|
||||
# Even forced, "latest" only moves forward: horizon-server update and install.sh follow it.
|
||||
reasons = [r for r in reasons if r == "it is already stable" or r.startswith("it is not newer")]
|
||||
if reasons:
|
||||
return None, f"{tag} stays a beta: " + "; ".join(reasons)
|
||||
return release, f"{tag} promoted by hand" + (" with force" if force else "")
|
||||
@@ -122,6 +114,35 @@ def choose(releases, blockers, now, tag=None, force=False):
|
||||
return None, "no beta is due" + (" (" + " / ".join(held[:3]) + ")" if held else "")
|
||||
|
||||
|
||||
def stalled(releases, now):
|
||||
"""(the oldest beta newer than the stable release, how long it has waited) once that is STALL_AFTER, else None."""
|
||||
games = [r for r in releases if not r["draft"] and GAME_TAG.fullmatch(r["tag_name"])]
|
||||
current = stable(games)
|
||||
waiting = [r for r in games if r["prerelease"] and (not current or tag_key(r["tag_name"]) > tag_key(current["tag_name"]))]
|
||||
if not waiting:
|
||||
return None
|
||||
oldest = min(waiting, key=lambda r: parse_time(r["published_at"]))
|
||||
age = now - parse_time(oldest["published_at"])
|
||||
return (oldest, age) if age >= STALL_AFTER else None
|
||||
|
||||
|
||||
def stall_issue(releases, stall, reason):
|
||||
"""The title and body of the issue saying promotion has stalled."""
|
||||
oldest, age = stall
|
||||
current = stable([r for r in releases if not r["draft"] and GAME_TAG.fullmatch(r["tag_name"])])
|
||||
hours = int(age.total_seconds() // 3600)
|
||||
body = (f"Opened by .github/workflows/promote.yml, not by a person.\n\n"
|
||||
f"No beta has become stable for {hours} hours: {oldest['tag_name']} has waited since "
|
||||
f"{oldest['published_at']}, and launchers, servers and install.sh still get "
|
||||
f"{current['tag_name'] if current else 'no stable release'}.\n\n"
|
||||
f"The last check said: {reason}\n\n"
|
||||
"Usual causes: an open `release-blocker` issue (it holds every beta until it is closed), the Mac mini's "
|
||||
"release smoke test not running (no smoke-test.json on the betas), or the promote workflow disabled. "
|
||||
"To promote a beta by hand: `gh workflow run promote -f tag=<tag>` (add `-f force=true` to skip the "
|
||||
"smoke test and blockers). This issue closes itself once a beta is promoted.")
|
||||
return f"{STALLED}: {oldest['tag_name']} has waited {hours} h", body
|
||||
|
||||
|
||||
def gh(*arguments, capture=True):
|
||||
result = subprocess.run(["gh", *arguments], cwd=ROOT, capture_output=capture, text=True)
|
||||
if result.returncode:
|
||||
@@ -166,8 +187,25 @@ def main():
|
||||
if os.environ.get("GITHUB_STEP_SUMMARY"):
|
||||
with open(os.environ["GITHUB_STEP_SUMMARY"], "a") as summary:
|
||||
summary.write(f"### {line}\n")
|
||||
report_stall(releases, release, reason, now, args.dry_run)
|
||||
return 1 if args.tag and not release else 0
|
||||
|
||||
|
||||
def report_stall(releases, promoted, reason, now, dry_run):
|
||||
"""Opens the stalled-promotion issue when one is due and none is open; closes it after a promotion."""
|
||||
open_issues = [issue for issue in gh_pages(f"repos/{REPO}/issues?state=open&per_page=100")
|
||||
if "pull_request" not in issue and issue["title"].startswith(STALLED)]
|
||||
stall = None if promoted else stalled(releases, now)
|
||||
if stall and not open_issues:
|
||||
title, body = stall_issue(releases, stall, reason)
|
||||
print(("Would open: " if dry_run else "Opening: ") + title)
|
||||
if not dry_run:
|
||||
gh("issue", "create", "--repo", REPO, "--title", title, "--body", body)
|
||||
if promoted and not dry_run:
|
||||
for issue in open_issues:
|
||||
gh("issue", "close", str(issue["number"]), "--repo", REPO, "--comment",
|
||||
f"{promoted['tag_name']} is stable now (promote.yml).")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
+8
-5
@@ -42,15 +42,18 @@ try {
|
||||
console.warn(`links.json: ${e.message}; using the built-in links`);
|
||||
}
|
||||
|
||||
// An optional token (a Railway variable, or `gh auth token` locally) lifts the rate limit.
|
||||
const githubHeaders = { Accept: "application/vnd.github+json", ...(process.env.GITHUB_TOKEN ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } : {}) };
|
||||
let releases = [];
|
||||
try {
|
||||
const res = await fetch(`https://api.github.com/repos/${REPO}/releases?per_page=100`, {
|
||||
// An optional token (a Railway variable, or `gh auth token` locally) lifts the rate limit.
|
||||
headers: { Accept: "application/vnd.github+json", ...(process.env.GITHUB_TOKEN ? { Authorization: `Bearer ${process.env.GITHUB_TOKEN}` } : {}) },
|
||||
signal: AbortSignal.timeout(15000),
|
||||
});
|
||||
const res = await fetch(`https://api.github.com/repos/${REPO}/releases?per_page=100`, { headers: githubHeaders, signal: AbortSignal.timeout(15000) });
|
||||
if (res.ok) releases = (await res.json()).filter((r) => !r.draft);
|
||||
else console.warn(`releases: ${res.status} from GitHub; the page will load them itself`);
|
||||
// A day of betas can push the stable release out of the newest 100: it is GitHub's "latest" (betas never are).
|
||||
if (res.ok && !releases.some((r) => /^v\d{4}\./.test(r.tag_name) && !r.prerelease)) {
|
||||
const latest = await fetch(`https://api.github.com/repos/${REPO}/releases/latest`, { headers: githubHeaders, signal: AbortSignal.timeout(15000) });
|
||||
if (latest.ok) releases.push(await latest.json());
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`releases: ${e.message}; the page will load them itself`);
|
||||
}
|
||||
|
||||
+10
-5
@@ -39,14 +39,21 @@ const slim = (r) => ({
|
||||
body: r.body || "",
|
||||
assets: r.assets.map((a) => ({ name: a.name, browser_download_url: a.browser_download_url, size: a.size })),
|
||||
});
|
||||
const isGame = (tag) => /^v\d{4}\.\d{1,2}\.\d{1,2}/.test(tag);
|
||||
const isLauncher = (r) => r.tag_name.startsWith("launcher-v") && !r.prerelease;
|
||||
const versionKey = (tag) => tag.replace("launcher-v", "").split(".").map(Number);
|
||||
const newer = (a, b) => versionKey(b).reduce((d, n, i) => d || n - (versionKey(a)[i] || 0), 0);
|
||||
|
||||
// The newest 30 releases. Game releases come out several times a day, so the newest launcher release can be
|
||||
// older than all of them: then it is looked up by its tag (the newest launcher-v tag with a published release).
|
||||
// The newest 100 releases (GitHub's most per page). Game betas come out several times a day, so the stable game
|
||||
// release and the newest launcher release can both be older than all of them. The stable game release is then
|
||||
// GitHub's "latest" (betas and launcher releases are never marked latest); the launcher release is looked up by its
|
||||
// tag (the newest launcher-v tag with a published release).
|
||||
async function loadReleases() {
|
||||
const list = (await get(`https://api.github.com/repos/${REPO}/releases?per_page=30`)).filter((r) => !r.draft).map(slim);
|
||||
const list = (await get(`https://api.github.com/repos/${REPO}/releases?per_page=100`)).filter((r) => !r.draft).map(slim);
|
||||
if (!list.some((r) => isGame(r.tag_name) && !r.prerelease)) {
|
||||
const latest = await get(`https://api.github.com/repos/${REPO}/releases/latest`).catch(() => null);
|
||||
if (latest && !latest.draft) list.push(slim(latest));
|
||||
}
|
||||
if (list.some(isLauncher)) return list;
|
||||
const refs = await get(`https://api.github.com/repos/${REPO}/git/matching-refs/tags/launcher-v`).catch(() => []);
|
||||
const tags = refs.map((r) => r.ref.replace("refs/tags/", "")).filter((t) => /^launcher-v\d+\.\d+\.\d+$/.test(t)).sort(newer);
|
||||
@@ -99,8 +106,6 @@ async function setUpDownload() {
|
||||
|
||||
// --- Patch notes and the links from main ---------------------------------
|
||||
|
||||
const isGame = (tag) => /^v\d{4}\.\d{1,2}\.\d{1,2}/.test(tag);
|
||||
|
||||
async function setUpNotes() {
|
||||
const list = (await releases).filter((r) => isGame(r.tag_name) && !r.prerelease);
|
||||
if (list.length) document.getElementById("releases").innerHTML = releasesHtml(list.slice(0, 3));
|
||||
|
||||
Reference in New Issue
Block a user