Skip to content

Commit df8254e

Browse files
committed
build: Allow release candidate (rc) versions
After this, running `bump2version rc` will increment the `rc` value if the current version is an rc. While `bump2version` has a good way to handle a release process that always goes through a release candidate phase, it doesn't have good support for an optional release candidate phase. For example, if the current version is 6.45.0, `bump2version rc` will change the version to 6.45.0rc1. That would be wrong as 6.45.0rc1 is older than 6.45.0. Therefore, rc releases should only be done manually by developers to ensure the new version is correct. See the README for details. Note that the trailing space and real tabs in the config file are intentional as that matches how `ConfigParser` will write back the file when bumping `current_version`. Without that we'd just get a spurious whitespace change on the next version bump.
1 parent 7b48b27 commit df8254e

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

.bumpversion.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
current_version = 6.44.0
33
commit = True
44
tag = True
5+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(rc(?P<rc>\d+))?
6+
serialize =
7+
{major}.{minor}.{patch}rc{rc}
8+
{major}.{minor}.{patch}

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,36 @@ The `bump-version` script can also be run with options such as
218218
also specify `--current-version` to see the effect without actually
219219
changing the current version. See `bumpversion --help` for all options.
220220

221+
#### Release candidates
222+
223+
PyPI and `pip` support release candidates with the `rc<N>` suffix. Prior
224+
to major releases it may be helpful to build and publish release
225+
candidates so they can be tested prior to general availability. Our
226+
`bumpversion` configuration has limited support for release candidates,
227+
so care should be taken to ensure the new version comes out correctly.
228+
229+
To begin a release candidate series, the version must be fully specified:
230+
231+
```bash
232+
yarn bump-version major "Komodo Dragon" --new-version 7.0.0rc1
233+
```
234+
235+
To make the next release candidate, run:
236+
237+
``` bash
238+
yarn bump-version rc
239+
```
240+
241+
Finally, to end a release candidate series, the version must be fully
242+
specified again:
243+
244+
``` bash
245+
yarn bump-version major "Komodo Dragon" --new-version 7.0.0
246+
```
247+
248+
In all cases, the commit and tag must be pushed to the remote as
249+
explained above.
250+
221251
### How to display the build information
222252

223253
To show the build information in the front page, as a tag in top right corner,

scripts/bump_version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def _update_version_name(version_name):
3333
ap.add_argument(
3434
"part",
3535
metavar="PART",
36-
choices=("major", "minor"),
36+
choices=("major", "minor", "rc"),
3737
help="Part of the version number to be bumped",
3838
)
3939
ap.add_argument(

0 commit comments

Comments
 (0)