We use bump2version to version our builds and releases in Gitlab, using a simple major.minor.patch (1.1.17) format.
Sometimes, however, it's useful to create versions outside the regular pipeline, with a custom version format, e.g. 1.1.17-test-1.
Trying bump2versions command line flags like this on a current version of 1.1.17:
bump2version.exe --search 1.0.17 --replace 1.0.17-testing --verbose --new-version 1.0.17-test-1 part
Don't give any errors, but produces the wrong version-string in all files where the version-string is being managed.
The .bumpversion.cfg file looks like this:
[bumpversion]
current_version = 1.0.17
[bumpversion:file:CMakeLists.txt]
search = MVR_VERSION "{current_version}"
replace = MVR_VERSION "{new_version}"
[bumpversion:file:VERSION.txt]
search = {current_version}
replace = {new_version}
[bumpversion:file:installer/mvr.iss]
search = #define MyAppVersion "{current_version}"
replace = #define MyAppVersion "{new_version}"
In each file where the version-string is supposed to be changed, the change looks like this:
set(MVR_VERSION "MVR_VERSION "1.0.17"" )
which is not right. Proper search/replace would be
set(MVR_VERSION "1.0.17-test-1" )
Any hints on how to use bump2versions flags to achieve a custom version?
As of
bump2version
v1.0.1, it won't produce the syntax error anymore.You should do the following:
part
s for the 'test' and '1' parts of your version string. Let's call them 'release' and 'build'.build
part to havevalues
and anoptional_value
.parse
so that both new parts can be parsed from a version string.serialize
options, so that a version number can exist with and without the two optional parts.This is the config:
And this command succeeds: