Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit d731ed7

Browse files
authored
Fixes to the release script (#10239)
* rename major/minor into the right semver terminology minor/patch (since this was something that got me very confused the first couple of times I've used the script) * name the release branch based on the new version, not the previous one
1 parent 3946730 commit d731ed7

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

changelog.d/10239.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the release script to use the semver terminology and determine the release branch based on the next version.

scripts-dev/release.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ def run():
8383
if current_version.pre:
8484
# If the current version is an RC we don't need to bump any of the
8585
# version numbers (other than the RC number).
86-
base_version = "{}.{}.{}".format(
87-
current_version.major,
88-
current_version.minor,
89-
current_version.micro,
90-
)
91-
9286
if rc:
9387
new_version = "{}.{}.{}rc{}".format(
9488
current_version.major,
@@ -97,49 +91,57 @@ def run():
9791
current_version.pre[1] + 1,
9892
)
9993
else:
100-
new_version = base_version
94+
new_version = "{}.{}.{}".format(
95+
current_version.major,
96+
current_version.minor,
97+
current_version.micro,
98+
)
10199
else:
102-
# If this is a new release cycle then we need to know if its a major
103-
# version bump or a hotfix.
100+
# If this is a new release cycle then we need to know if it's a minor
101+
# or a patch version bump.
104102
release_type = click.prompt(
105103
"Release type",
106-
type=click.Choice(("major", "hotfix")),
104+
type=click.Choice(("minor", "patch")),
107105
show_choices=True,
108-
default="major",
106+
default="minor",
109107
)
110108

111-
if release_type == "major":
112-
base_version = new_version = "{}.{}.{}".format(
113-
current_version.major,
114-
current_version.minor + 1,
115-
0,
116-
)
109+
if release_type == "minor":
117110
if rc:
118111
new_version = "{}.{}.{}rc1".format(
119112
current_version.major,
120113
current_version.minor + 1,
121114
0,
122115
)
123-
116+
else:
117+
new_version = "{}.{}.{}".format(
118+
current_version.major,
119+
current_version.minor + 1,
120+
0,
121+
)
124122
else:
125-
base_version = new_version = "{}.{}.{}".format(
126-
current_version.major,
127-
current_version.minor,
128-
current_version.micro + 1,
129-
)
130123
if rc:
131124
new_version = "{}.{}.{}rc1".format(
132125
current_version.major,
133126
current_version.minor,
134127
current_version.micro + 1,
135128
)
129+
else:
130+
new_version = "{}.{}.{}".format(
131+
current_version.major,
132+
current_version.minor,
133+
current_version.micro + 1,
134+
)
136135

137136
# Confirm the calculated version is OK.
138137
if not click.confirm(f"Create new version: {new_version}?", default=True):
139138
click.get_current_context().abort()
140139

141140
# Switch to the release branch.
142-
release_branch_name = f"release-v{current_version.major}.{current_version.minor}"
141+
parsed_new_version = version.parse(new_version)
142+
release_branch_name = (
143+
f"release-v{parsed_new_version.major}.{parsed_new_version.minor}"
144+
)
143145
release_branch = find_ref(repo, release_branch_name)
144146
if release_branch:
145147
if release_branch.is_remote():
@@ -153,7 +155,7 @@ def run():
153155
# release type.
154156
if current_version.is_prerelease:
155157
default = release_branch_name
156-
elif release_type == "major":
158+
elif release_type == "minor":
157159
default = "develop"
158160
else:
159161
default = "master"

0 commit comments

Comments
 (0)