Skip to content

Commit 761ec07

Browse files
committed
release from main only
AI Prompts: claude-sonnet-4-6: <ide_opened_file>The user opened the file ./release in the IDE. This may or may not be related to the current task.</ide_opened_file> make sure that ./release operated on main and push main before tagging
1 parent a6a291c commit 761ec07

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

release

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,17 @@ def main() -> None:
3232
if version.startswith("v"):
3333
die(f"version must not start with 'v', got: {version!r}")
3434

35+
# ensure we're on main
36+
branch = subprocess.run(
37+
["git", "rev-parse", "--abbrev-ref", "HEAD"],
38+
capture_output=True,
39+
text=True,
40+
check=True,
41+
cwd=ROOT,
42+
).stdout.strip()
43+
if branch != "main":
44+
die(f"must be on main branch, currently on: {branch!r}")
45+
3546
print(f"releasing {version}")
3647

3748
# pyproject.toml
@@ -73,6 +84,7 @@ def main() -> None:
7384
print("\nworking tree has changes — commit them, then re-run to tag and push")
7485
else:
7586
tag = f"v{version}"
87+
subprocess.run(["git", "push", "origin", "main"], check=True, cwd=ROOT)
7688
subprocess.run(["git", "tag", "-a", tag, "-m", f"Release {tag}"], check=True, cwd=ROOT)
7789
print(f" tagged {tag}")
7890
subprocess.run(["git", "push", "origin", tag], check=True, cwd=ROOT)

0 commit comments

Comments
 (0)