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

No Pre-Release Tags if Major Version is 0 #214

Open adamgranthendry opened 3 years ago

adamgranthendry commented 3 years ago

Is there a way to prevent pre-release tags from appearing if the major verison is 0 (i.e. rapid development?). As it stands, my .bumpversion.cfg is

[bumpversion]
current_version = 0.0.0
tag = False
tag_name = {new_version}
commit = True
parse =
    (?P<major>\d+)
    \.
    (?P<minor>\d+)
    \.
    (?P<patch>\d+)
    (\-(?P<pre>[a-z]+)\.(?P<prenum>\d+))?
serialize =
    {major}.{minor}.{patch}-{pre}.{prenum}
    {major}.{minor}.{patch}

[bumpversion:part:pre]
optional_value = placeholder
first_value = alpha
values =
    alpha
    beta
    rc
    placeholder

[bumpversion:part:prenum]
first_value = 1

[bumpversion:file:pyproject.toml]

which adds pre-release values when I bump part minor

>>> bumpversion minor
Bumpversion: 0.0.0 -> 0.1.0-alpha.1

I want this behavior to occur when going from major rev 0 to 1 or N to N+1 for all N > 0, just not for rapid development. I'd hate to have to manually type out --new-version for every bump while in rapid development.

Does anyone have a solution?

adamgranthendry commented 3 years ago

Please see my StackOverflow answer for a "monkey-patch"/work-around solution.