feat(release): allow release branches via RELEASE_BRANCHES env (default main)

This commit is contained in:
m4
2026-08-13 10:35:55 +08:00
parent ae461d1c2d
commit 59c77c65b1
+8 -3
View File
@@ -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: