callowayproject/bump-my-version

Call a command before committing

Opened this issue · 3 comments

Thanks for the great package!

I would like to use the tool with towncrier, my workflow is:

  • bump version
  • build changelog with towncrier
  • ... whatever I need to do before a release
  • commit

It could be done with a command option (for CLI and config file), passing environment variables {version} and {old_version}.
The command would be called before commit, and do not commit if the command returns an error. It could even revert the version if command fails, so it would work with the pre-commit package.

@getzze This is unlikely to get any priority, as the focus of bump-my-version is not a workflow tool.

However, since you already know the version increment (major/minor/patch/etc.) ahead of time, you can start with a call to bump-my-version show -i <incr part> new_version and get the version from stdout.

When you finally make your last call to bump-my-version bump make sure you either add --allow-dirty or set the allow_dirty configuration option to True

coordt commented

@getzze I'm going to be releasing a new version that provides hooks for scripts to run during the process here: #228

Feel free to look at it and let me know if you have any advice.