callowayproject / bump-my-version

A small command line tool to simplify releasing software by updating all version strings in your source code by the correct increment and optionally commit and tag the changes.
https://callowayproject.github.io/bump-my-version/
MIT License
249 stars 17 forks source link

Feature Request: Provide option to perform tag prior to bumping the version and commit. #200

Open dawgware opened 3 weeks ago

dawgware commented 3 weeks ago

Description

We utilize Release Branching for our development lifecycle and we tag releases and patches from these branches. A release tag is generated off the current version in the branch, so the initial release tag would be x.y.1 and subsequent patches are x.y.2-n.

The problem I'm having with bump-my-version is that the version is bumped to new_version before performing the tag which makes the tag-name and app version incorrect in our workflow. What we need is the tag to be performed using current_version so the tag-name and the version in the app files would be consistent with our release stategy. Most of our apps are maven projects and utilize maven release:prepare release:perform which tags release first then updates the version for next iteration. I'm trying to replicate this process for our python apps.

I've reviewed the documentation and tested the application but I do not see a way to force the tag before bumping the version.

An option like --tag-first or --tag-before-bump would create the tag with the current_version, then bump the version and commit the new_version updates.

What I Did

The workaround I've been using is to tag the release via git cli then bump the version and commit changes with bump-my-version. This works but is cumbersome and would prefer the convenience of bump-my-version to handle both tagging and versioning.

    git tag -a ${_tag} -m "prepare release ${_tag}"
    git push origin tag ${_tag}
    bump-my-version bump patch --no-tag --config-file .bumpversion.toml 
    git push origin ${BRANCHTORELEASE}
coordt commented 2 weeks ago

@dawgware, could you possibly give me more information on the Release Branching process? I looked for information about how Maven does things and tried to find a good answer about the process. Any links to how the workflow works would be appreciated so I can get more context about this issue.

dawgware commented 6 days ago

@coordt Here's a link to the Maven release plugin Prepare Release documentation. And here's a brief summary of Release Branching

Maven Prepare Release updates the pom version by removing the x-SNAPSHOT for release version. In our case, the version is the branch and patch numbers, e.g. 24.23.2 so Maven takes the development version 24.23.2-SNAPSHOT and removes the -SNAPSHOT, 24.23.2 becomes the release version and the tag name is -24.23.2. Maven then commits the changes and creates the tag. Next Maven updates the pom with the next development version, e.g. 24.23.3-SNAPSHOT and commits the changes.

Hope this helps.