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

bump_each_commit: false increments patch version #154

Closed
serpro69 opened this issue Apr 18, 2024 · 3 comments
Closed

bump_each_commit: false increments patch version #154

serpro69 opened this issue Apr 18, 2024 · 3 comments

Comments

@serpro69
Copy link

Hi,

This is the action configuration:

with:
    tag_prefix: v
    major_pattern: [major]
    minor_pattern: [minor]
    version_format: ${major}.${minor}.${patch}
    bump_each_commit: false
    search_commit_body: true
    enable_prerelease_mode: false
    debug: true
    version_from_branch: false
    branch: HEAD
    use_branches: false
    user_format_type: csv

Previous tag was v0.1.0. Next commit resulted in v0.1.1 tag when no keywords were specified.
Looks like bump_each_commit: false doesn't really work? Or am I don't something wrong?

Full action output:

{
  "version": "0.1.1",
  "major": "0",
  "minor": "1",
  "patch": "1",
  "increment": "0",
  "version_type": "patch",
  "changed": "true",
  "is_tagged": "false",
  "version_tag": "v0.1.1",
  "authors": "Serhii P <[email protected]>",
  "previous_commit": "d7375f2cd51b1f27ab6c575d1e14188659d33eb2",
  "previous_version": "0.1.0",
  "current_commit": "e223162348b4d5fdae35899c4a26dadeadbbc6fe",
  "debug_output": "{\"commands\":[{\"command\":\"git\",\"args\":[\"rev-parse\",\"--abbrev-ref\",\"HEAD\"],\"output\":\"main\\n\",\"stderr\":\"\",\"error\":null},{\"command\":\"git\",\"args\":[\"rev-list\",\"-n1\",\"--all\"],\"output\":\"e223162348b4d5fdae35899c4a26dadeadbbc6fe\\n\",\"stderr\":\"\",\"error\":null},{\"command\":\"git\",\"args\":[\"rev-parse\",\"HEAD\"],\"output\":\"e223162348b4d5fdae35899c4a26dadeadbbc6fe\\n\",\"stderr\":\"\",\"error\":null},{\"command\":\"git tag --points-at e223162348b4d5fdae35899c4a26dadeadbbc6fe v*[0-9].*[0-9].*[0-9]\",\"args\":[],\"output\":\"\",\"stderr\":\"\",\"error\":null},{\"command\":\"git for-each-ref --sort=-v:*refname --format=%(refname:short) --merged=e223162348b4d5fdae35899c4a26dadeadbbc6fe refs/tags/v*[0-9].*[0-9].*[0-9]\",\"args\":[],\"output\":\"v0.1.0\\nv0.0.4\\nv0.0.3\\nv0.0.2\\nv0.0.1\\n\",\"stderr\":\"\",\"error\":null},{\"command\":\"git\",\"args\":[\"merge-base\",\"v0.1.0\",\"e223162348b4d5fdae35899c4a26dadeadbbc6fe\"],\"output\":\"d7375f2cd51b1f27ab6c575d1e14188659d33eb2\\n\",\"stderr\":\"\",\"error\":null},{\"command\":\"git log --pretty=\\\"@@@START_RECORD%n@@@hash%n%H%n@@@subject%n%s%n@@@body%n%b%n@@@author%n%an%n@@@authorEmail%n%ae%n@@@authorDate%n%aI%n@@@committer%n%cn%n@@@committerEmail%n%ce%n@@@committerDate%n%cI%n@@@tags%n%d\\\" --author-date-order d7375f2cd51b1f27ab6c575d1e14188659d33eb2..e223162348b4d5fdae35899c4a26dadeadbbc6fe\",\"args\":[],\"output\":\"@@@START_RECORD\\n@@@hash\\ne223162348b4d5fdae35899c4a26dadeadbbc6fe\\n@@@subject\\nUpdate publish workflow name\\n@@@body\\n\\n@@@author\\nSerhii P\\n@@@authorEmail\\[email protected]\\n@@@authorDate\\n2024-04-18T20:13:58+02:00\\n@@@committer\\nGitHub\\n@@@committerEmail\\[email protected]\\n@@@committerDate\\n2024-04-18T20:13:58+02:00\\n@@@tags\\n (HEAD -> main, origin/main)\\n\",\"stderr\":\"\",\"error\":null}],\"empty\":false}"
}

Thanks

@PaulHatch
Copy link
Owner

By default, by the configuration you are using, tags are how you mark a version as "released". The next commit will be incremented. Since the last tag found was v0.1.0 the version for next commit will be incremented, it is defaulting to a "patch" type incrementing since none of the commit messages since the last tag include [major] or [minor].

Using bump_each_commit will increment the version on every commit, even if there is no commit. It is used in cases where every commit is intended to be "released" or produce a new version. You create three commits and you get three version increments. With this set to false, the commit after a tag will be incremented by one, but only by one no matter how many subsequent commits are added. The version produced by this action is a "pending" version, with the original intention be that once a particular commit passes QA/UAT or features slated for the next version are ready or whatever other criteria you are using to determine when to release are complete, you tag the commit and that commit is now "released", then you start over for the next version. If any major/minor changes are added during before the next release, that will be reflected in the next predicted version.

If you want to use a different approach or just understand the options available, have a look at the guide for examples of various configurations possible.

@serpro69
Copy link
Author

serpro69 commented Apr 18, 2024

Duplicate of #144

@serpro69
Copy link
Author

serpro69 commented Apr 18, 2024

Thanks a lot for your detailed response @PaulHatch !
Yeah, I just discovered the guide you mention and things are a bit clearer now on how the action is supposed to be used.
I do get now that this option is intended for a slightly different purpose. I think what I really needed is the combination of bump_each_commit and bump_each_commit_patch_pattern, which seems to do what I need exactly.

But the usage of only bump_each_commit: true may be confusing from just the option description. and it seems like I'm not the only one who misunderstands this option (looking at the other issue that was opened for this) :)
But of course reading the documentation (or rather not reading it 😀 ) might be what caused this issue in my case. I think I've skimmed over the "implied version" section too quick and didn't give it a second thought, which is where the misunderstanding started for me. Now I think I understand much better what's the intention here.

Thanks again!

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