GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

Manually incrementing the version

Open pampua84 opened this issue 4 years ago • 10 comments

Hello to all, I'm trying to manually update the patch version with a commit message like this:

_ "New class added. + Semver: patch" _

i am using ContinuousDeployment mode, this is the default configuration file:

assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
mode: ContinuousDeployment
tag-prefix: '[vV]'
continuous-delivery-fallback-tag: ci
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
tag-pre-release-weight: 60000
commit-message-incrementing: Enabled
branches:
  develop:
    mode: ContinuousDeployment
    tag: alpha
    increment: Minor
    prevent-increment-of-merged-branch-version: false
    track-merge-target: true
    regex: ^dev(elop)?(ment)?$
    source-branches: []
    tracks-release-branches: true
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 0
  main:
    mode: ContinuousDeployment
    tag: ''
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^master$|^main$
    source-branches:
    - develop
    - release
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: true
    pre-release-weight: 55000
  release:
    mode: ContinuousDeployment
    tag: beta
    increment: None
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^releases?[/-]
    source-branches:
    - develop
    - main
    - support
    - release
    tracks-release-branches: false
    is-release-branch: true
    is-mainline: false
    pre-release-weight: 30000
  feature:
    mode: ContinuousDeployment
    tag: useBranchName
    increment: Inherit
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    regex: ^features?[/-]
    source-branches:
    - develop
    - main
    - release
    - feature
    - support
    - hotfix
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  pull-request:
    mode: ContinuousDeployment
    tag: PullRequest
    increment: Inherit
    prevent-increment-of-merged-branch-version: false
    tag-number-pattern: '[/-](?<number>\d+)'
    track-merge-target: false
    regex: ^(pull|pull\-requests|pr)[/-]
    source-branches:
    - develop
    - main
    - release
    - feature
    - support
    - hotfix
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  hotfix:
    mode: ContinuousDeployment
    tag: beta
    increment: Patch
    prevent-increment-of-merged-branch-version: false
    track-merge-target: false
    regex: ^hotfix(es)?[/-]
    source-branches:
    - develop
    - main
    - support
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: false
    pre-release-weight: 30000
  support:
    mode: ContinuousDeployment
    tag: ''
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    regex: ^support[/-]
    source-branches:
    - main
    tracks-release-branches: false
    is-release-branch: false
    is-mainline: true
    pre-release-weight: 55000
ignore:
  sha: []
commit-date-format: yyyy-MM-dd
merge-message-formats: {}
update-build-number: true

and this is my GitVersion.yml file:

mode: ContinuousDeployment
next-version: 1.0.0
branches: {}
ignore:
  sha: []
merge-message-formats: {}

but this doesn't work. I have installed gitversion.tool version '5.7.0'.

Thanks

pampua84 avatar Nov 12 '21 10:11 pampua84

Have you tried mode: Mainline or commit-message-incrementing: Enabled?

asbjornu avatar Nov 12 '21 11:11 asbjornu

Hi @asbjornu, unfortunately it doesn't even work in mainline mode,but it should also work in ContinuousDeployment mode, at least so it is specified in the doc.

pampua84 avatar Nov 15 '21 16:11 pampua84

Sounds like this should be possible to reproduce in a test. Could you please create one in a PR?

asbjornu avatar Mar 02 '22 23:03 asbjornu

What exactly do you mean by creating a test in the Pull Request?

pampua84 avatar Mar 11 '22 17:03 pampua84

Something like this:

https://github.com/GitTools/GitVersion/blob/c0b15090105d5230f9998e314271f27e4f9280bd/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentMode.cs#L34-L98

asbjornu avatar Mar 14 '22 16:03 asbjornu

I created the test, the first increment works, the second doesn't and the test fails.

pampua84 avatar Mar 20 '22 19:03 pampua84

Hi @asbjornu are there any updates about it? Thanks

pampua84 avatar Apr 07 '22 19:04 pampua84

I haven't investigated what the difference between your submitted (failing) test and the existing (successful) test. But you can see that your use-case should be working in the following test:

https://github.com/GitTools/GitVersion/blob/26ee6317f13823242168aec70ea4f1a8024206d3/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentMode.cs#L433-L437

asbjornu avatar Apr 17 '22 10:04 asbjornu

Hi @asbjornu in my test case I have two consecutive increments, the first increment passes the test, the second does not because the patch remains the same:

fixture.BranchTo("development", "development");
fixture.MakeACommit("2 +semver: patch");

fixture.AssertFullSemver("0.1.1-alpha.1", this.config);   // Test pass

fixture.MakeACommit("3 +semver: patch");

fixture.AssertFullSemver("0.1.2-alpha.2", this.config);  // Test failed

Is there any reason why I can't do this? Thanks

pampua84 avatar May 03 '22 19:05 pampua84

I see. No, I don't see a good reason why this shouldn't be possible. Pull requests are welcome.

asbjornu avatar May 04 '22 21:05 asbjornu

I think this issue is related to https://github.com/GitTools/GitVersion/issues/3097. I saw the following comment from orionstudt:

AFAIK this is expected behavior. If your release has multiple features you don't increment the minor N times for every feature, you increment it once. If you want to increment the minor version again, you need to tell it that it is the next release by tagging with 1.5.0

HHobeck avatar Mar 18 '23 14:03 HHobeck

I think this is not a bug and the actual behavior is intentional.

HHobeck avatar Mar 20 '23 10:03 HHobeck

:tada: This issue has been resolved in version 6.0.0-beta.2 :tada: The release is available on:

Your GitReleaseManager bot :package::rocket:

arturcic avatar Apr 06 '23 19:04 arturcic