Skip to content

Commit 0931c98

Browse files
committed
Update release script
The new versioning workflow will bump the version number immediately after the previous release.
1 parent 6664fab commit 0931c98

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

scripts/bump_version.py renamed to scripts/release_version.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,12 @@ def main():
7171

7272
increment = None
7373
properties = PropertiesFile(str(PROJECT_DIR / "gradle.properties"))
74-
previous_version = parse_version(properties[PROJECT_VERSION_KEY])
74+
version = parse_version(properties[PROJECT_VERSION_KEY])
7575

7676
print()
77-
print(f"Currently @{previous_version}.")
77+
print(f"Releasing version {version}.")
7878
print()
7979

80-
while increment not in INCREMENTS.keys():
81-
increment = input("How do you want to increment? [major/minor/patch] ")
82-
83-
new_version = INCREMENTS[increment](previous_version)
84-
85-
# Apply new version to project
86-
print(f"Updating project version to {new_version}...")
87-
properties[PROJECT_VERSION_KEY] = str(new_version)
88-
8980
# Fetch new changelog message from user
9081
temp = tempfile.NamedTemporaryFile(delete=False)
9182
temp_path = Path(temp.name).absolute()
@@ -112,14 +103,24 @@ def main():
112103

113104
print("Updating changelog...")
114105
changelog = ChangelogFile(PROJECT_DIR / "CHANGELOG.md")
115-
changelog.prepend_version(new_version, changelog_message)
106+
changelog.prepend_version(version, changelog_message)
116107

117-
print("Creating Git commit and tag...")
118-
tag_message = "\n".join([f"Update version to {new_version}", ""] + changelog_message)
119-
commit_message = "\n".join([f"Update version to {new_version}", "", f"Increment to the next {increment} version."])
108+
print("Creating Git tag...")
109+
tag_message = "\n".join([f"Version {version}", ""] + changelog_message)
110+
subprocess.run(["git", "tag", "-a", f"{version}", "-m", tag_message], cwd=PROJECT_DIR)
111+
112+
while increment not in INCREMENTS.keys():
113+
increment = input("How do you want to increment? [major/minor/patch] ")
114+
115+
new_version = INCREMENTS[increment](version)
116+
117+
# Apply new (development) version to project
118+
print(f"Updating next dev version to {new_version}...")
119+
properties[PROJECT_VERSION_KEY] = str(new_version)
120120

121+
print("Creating Git commit for next dev version...")
122+
commit_message = f"Bump version to {new_version}"
121123
subprocess.run(["git", "add", "."], cwd=PROJECT_DIR)
122124
subprocess.run(["git", "commit", "-m", commit_message], cwd=PROJECT_DIR)
123-
subprocess.run(["git", "tag", "-a", f"{new_version}", "-m", tag_message], cwd=PROJECT_DIR)
124125

125126
main()

0 commit comments

Comments
 (0)