From 59c77c65b1687086acce9e91ba0fe876dfd6e28d Mon Sep 17 00:00:00 2001 From: m4 Date: Thu, 13 Aug 2026 10:35:55 +0800 Subject: [PATCH] feat(release): allow release branches via RELEASE_BRANCHES env (default main) --- scripts/release.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/release.py b/scripts/release.py index f04734d..af28975 100644 --- a/scripts/release.py +++ b/scripts/release.py @@ -170,6 +170,11 @@ def main(argv=None, *, run=subprocess.run, repo_root: Path | None = None) -> int return result def precheck(): + allowed = { + b.strip() + for b in os.environ.get("RELEASE_BRANCHES", "main").split(",") + if b.strip() + } for r in (backend, webui): out = run(["git", "-C", str(r), "status", "--porcelain"], capture_output=True, text=True) if out.stdout.strip(): @@ -178,9 +183,9 @@ def main(argv=None, *, run=subprocess.run, repo_root: Path | None = None) -> int ["git", "-C", str(r), "branch", "--show-current"], capture_output=True, text=True, - ) - if branch.stdout.strip() != "main": - raise RuntimeError(f"{r} is not on main") + ).stdout.strip() + if branch not in allowed: + raise RuntimeError(f"{r} is on {branch}, not in RELEASE_BRANCHES {sorted(allowed)}") def tests(): if args.skip_tests: