Skip to content

Commit a778c8f

Browse files
committed
make sure we fail and reset
1 parent 2f729e4 commit a778c8f

File tree

1 file changed

+27
-23
lines changed

1 file changed

+27
-23
lines changed

scripts/release.py

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,30 @@ def fail_and_revert(msg):
8282
exit(1)
8383

8484

85-
# sync with remote no matter what
86-
if subprocess.run(["git", "push"]).returncode != 0:
87-
fail_and_revert("Failed to push")
88-
89-
# 1. build the package via uv
90-
print("uv build")
91-
if subprocess.run(["uv", "build"]).returncode != 0:
92-
fail_and_revert("Failed to build the package")
93-
94-
# 2. create a new release
95-
print(f"gh release create {new_v} dist/*")
96-
if (
97-
subprocess.run(
98-
[
99-
"gh",
100-
"release",
101-
"create",
102-
"v" + new_v,
103-
]
104-
).returncode
105-
!= 0
106-
):
107-
fail_and_revert("Failed to create release")
85+
try:
86+
# sync with remote no matter what
87+
if subprocess.run(["git", "push"]).returncode != 0:
88+
fail_and_revert("Failed to push")
89+
90+
# 1. build the package via uv
91+
print("uv build")
92+
if subprocess.run(["uv", "build"]).returncode != 0:
93+
fail_and_revert("Failed to build the package")
94+
95+
# 2. create a new release
96+
print(f"gh release create {new_v} dist/*")
97+
if (
98+
subprocess.run(
99+
[
100+
"gh",
101+
"release",
102+
"create",
103+
"v" + new_v,
104+
]
105+
).returncode
106+
!= 0
107+
):
108+
fail_and_revert("Failed to create release")
109+
110+
except Exception as e:
111+
fail_and_revert(str(e))

0 commit comments

Comments
 (0)