GitVersion
GitVersion copied to clipboard
Manually incrementing the version
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
Have you tried mode: Mainline or commit-message-incrementing: Enabled?
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.
Sounds like this should be possible to reproduce in a test. Could you please create one in a PR?
What exactly do you mean by creating a test in the Pull Request?
Something like this:
https://github.com/GitTools/GitVersion/blob/c0b15090105d5230f9998e314271f27e4f9280bd/src/GitVersion.Core.Tests/IntegrationTests/MainlineDevelopmentMode.cs#L34-L98
I created the test, the first increment works, the second doesn't and the test fails.
Hi @asbjornu are there any updates about it? Thanks
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
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
I see. No, I don't see a good reason why this shouldn't be possible. Pull requests are welcome.
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
I think this is not a bug and the actual behavior is intentional.
:tada: This issue has been resolved in version 6.0.0-beta.2 :tada: The release is available on:
Your GitReleaseManager bot :package::rocket: