Skip to content

Commit 45e2c29

Browse files
committed
Update release branch
Signed-off-by: Bernát Gábor <[email protected]>
1 parent 864332f commit 45e2c29

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tasks/release.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,19 @@ def main(version_str: str) -> None:
1717
if repo.is_dirty():
1818
raise RuntimeError("Current repository is dirty. Please commit any changes and try again.")
1919
upstream, release_branch = create_release_branch(repo, version)
20-
release_commit = release_changelog(repo, version)
21-
tag = tag_release_commit(release_commit, repo, version)
22-
print("push release commit")
23-
repo.git.push(upstream.name, release_branch)
24-
print("push release tag")
25-
repo.git.push(upstream.name, tag)
20+
try:
21+
release_commit = release_changelog(repo, version)
22+
tag = tag_release_commit(release_commit, repo, version)
23+
print("push release commit")
24+
repo.git.push(upstream.name, f"{release_branch}:main", "-f")
25+
print("push release tag")
26+
repo.git.push(upstream.name, tag, "-f")
27+
finally:
28+
print("checkout main to new release and delete release branch")
29+
repo.heads.main.checkout()
30+
repo.delete_head(release_branch)
31+
upstream.fetch()
32+
repo.git.reset("--hard upstream/main")
2633
print("All done! ✨ 🍰 ✨")
2734

2835

0 commit comments

Comments
 (0)