peritus / bumpversion

Version-bump your software with a single command
https://pypi.python.org/pypi/bumpversion
MIT License
1.5k stars 148 forks source link

bumpversion w/ added "commit" part adding additional parts to files #215

Open connormason opened 2 years ago

connormason commented 2 years ago

Hi all, it's very likely what I'm seeing is user error, but I'm having trouble figuring out how exactly to get the result that I'm looking for. Really all I want to do is add an addition part to the end of a typical semvar versioning scheme to correlate to commit number after the last version bump. I plan to have this automatically get bumped in our repo CI. Here's what my config looks like:

[bumpversion]
current_version = 1.3.8.0
commit = False
message = [skip-ci] Bump version: {current_version} → {new_version}
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<commit>\d+))?
serialize = 
    {major}.{minor}.{patch}.{commit}
    {major}.{minor}.{patch}

[bumpversion:part:commit]

[bumpversion:file:repo/version.py]

[bumpversion:file:setup.py]

What I'm seeing is that when I run bumpversion commit with this config, the current_version in my config file is updated as I expect to 1.3.8.1. But in the other configured files (setup.py and repo/version.py), the version is being changed to 1.3.8.1.0. I tried adding the parse/serialize keys to the individual file configs, but I get the same result. Any idea what is going on here?

Thank you in advance!