Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call a command before committing #208

Closed
getzze opened this issue Jul 6, 2024 · 5 comments
Closed

Call a command before committing #208

getzze opened this issue Jul 6, 2024 · 5 comments

Comments

@getzze
Copy link

getzze commented Jul 6, 2024

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.

@coordt
Copy link
Member

coordt commented Jul 8, 2024

@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

@getzze
Copy link
Author

getzze commented Jul 8, 2024 via email

@coordt
Copy link
Member

coordt commented Aug 18, 2024

@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.

@coordt
Copy link
Member

coordt commented Aug 28, 2024

Version 0.26.0 should have what you need.

@coordt coordt closed this as completed Aug 28, 2024
@getzze
Copy link
Author

getzze commented Sep 16, 2024

Hi, thanks for adding this feature! I will try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants