Skip to content

Commit 06adcea

Browse files
github actions prepare release fix version number
1 parent fec939c commit 06adcea

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/scripts/prepare_release.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ def bump_version_number(version_number: str, level: str) -> str:
3939
major, minor, patch = version_number.split(".")
4040
if level == "major":
4141
major = str(int(major)+1)
42+
minor = "0"
43+
patch = "0"
4244
elif level == "minor":
4345
minor = str(int(minor)+1)
46+
patch = "0"
4447
elif level == "patch":
4548
patch = str(int(patch)+1)
4649
else:
@@ -111,7 +114,7 @@ def update_changelog(nvn):
111114
if "release date: " in line.lower():
112115
today = time.strftime("%Y-%m-%d")
113116
lines[i] = f"Release date: {today}"
114-
changelog.write("\n".join(lines).replace("\n\n", "\n"))
117+
changelog.write(re.sub("\n+$", "\n", "\n".join(lines)))
115118
changelog.write("\n")
116119
return GitFile('CHANGELOG.md')
117120

@@ -214,7 +217,7 @@ def prepare_new_release(level):
214217
else:
215218
raise
216219
new_version_number = bump_version_number(last_version_number, level)
217-
220+
raise Exception(new_version_number)
218221
update_setup(new_version_number).gitadd()
219222
update_version(new_version_number).gitadd()
220223
update_changelog(new_version_number).gitadd()

0 commit comments

Comments
 (0)