peritus / bumpversion

Version-bump your software with a single command

Home Page:https://pypi.python.org/pypi/bumpversion

Repository from Github https://github.comperitus/bumpversionRepository from Github https://github.comperitus/bumpversion

How to keep the metadata part when bumping version?

martinm82 opened this issue · comments

Hello,

we are using semantic versioning (semver.org) in our projects and stumbled upon the following problem:

We have some projects that extend some other upstream projects with some functionality (eg. forks). We want to version our projects with the following semver schema:

1.2.3+4.2.1
1.2.3-SNAPSHOT+4.2.1

where 1.2.3 is our own version of the project and 4.2.1, the metadata part of semver, which reflects the upstream version our changes are based on.

When releasing our versions we would like to have the following flow:

# current_version=1.2.3-SNAPSHOT+4.2.1
$ bumpversion release
# current_version=1.2.3+4.2.1
$ bumpversion patch
# current_version=1.2.4-SNAPSHOT+4.2.1

Right now we use the following configuration:

parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-zA-Z]+))?
serialize =
  {major}.{minor}.{patch}-{release}
  {major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = rel
values =
  dev
  rel

Is it possible to implement this kind of workflow where the metadata part (eg. +4.2.1) won't be touched?
I have tried various things but did not come up with something that just leaves the metadata part.
Also it would be great to have one config that covers the case with +metadata and without it.

Thanks a lot.