-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
feat(release): make the bump version rules configurable #530
feat(release): make the bump version rules configurable #530
Conversation
Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️ |
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #530 +/- ##
==========================================
+ Coverage 40.94% 41.23% +0.29%
==========================================
Files 15 15
Lines 1043 1048 +5
==========================================
+ Hits 427 432 +5
Misses 616 616
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
cd51f5e
to
bf9d866
Compare
I'm thinking if we should offer this as a config option (also environment variable) rather than a command-line argument. I don't think this will be used very often especially when the user is only interested in changelog generation rather than bumping the version. What do you think? |
I agree. I guess that, for the majority of projects, adding this option to the configuration (or using an environmental variable) would be the most convenient way. Do you have a preference under which config section this option should be added? |
I think the best option would be to add a new section as follows: [bump]
# Configures automatic minor version increments for feature changes.
# When true, a feature will always trigger a minor version update.
# When false, a feature will trigger:
# - a patch version update if the major version is 0.
# - a minor version update otherwise.
features_always_bump_minor = true
# Configures 0 -> 1 major version increments for breaking changes.
# When true, a breaking change commit will always trigger a major version update
# (including the transition from version 0 to 1)
# When false, a breaking change commit will trigger:
# - a minor version update if the major version is 0.
# - a major version update otherwise.
breaking_always_bump_major = true What do you think? |
bf9d866
to
4561796
Compare
Yes, I think this is the cleanest solution ✨ I've just updated my PR to use the new config section. I also changed the code so it doesn't change the pubic api of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Can you also add a test fixture? There is also one example under test-bump-version
.
4561796
to
47bd294
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for your contribution!
Congrats on merging your first pull request! ⛰️ |
closes #447
Description
This change adds a customization for version bumping. Specifically, it allows changing the default version bumping rules in order to preserve zero-based releases.
Motivation and Context
The current bumping rules are hard-coded, so it's necessary to extend the input arguments to allow for customization.
This PR adds a new CLI flag
--keep-zerover
. I also considered extending the configuration. However, it wasn't clear to me which section would be appropriate. Perhapschangelog
? I think that having it in the configuration would be quite convenient to users. It would also mean that the signature ofChangelog::bump_version
doesn't need to be modified. What do you think?This PR closes #447.
How Has This Been Tested?
I extended the unit tests for
calculate_next_version
. I also rungit cliff
with and without the new flag.Screenshots / Logs (if applicable)
Types of Changes
I wasn't sure if this should be considered a breaking change, but I've marked is a such to be on the safe side. My guess is that there wouldn't be a large number (if any) of users who use the current bump version feature with zero-based releases, as it would result in moving away from the zero-based system.
Checklist: