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

[ISSUE]: Semver on release branch containing prerelease number. #4175

Closed
2 tasks done
Tilusch opened this issue Aug 22, 2024 · 2 comments
Closed
2 tasks done

[ISSUE]: Semver on release branch containing prerelease number. #4175

Tilusch opened this issue Aug 22, 2024 · 2 comments

Comments

@Tilusch
Copy link

Tilusch commented Aug 22, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool

GitVersion version

6.0.2

Operating system

macOS

What are you seeing?

After Upgrading my config from Gitversion 5.12.0 to 6.0.2 things broke. I use the following config after going trough the breaking changes:

tag-prefix: ""
major-version-bump-message: "(^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)|^major:.*)"
minor-version-bump-message: "^(minor|feat)(\\([\\w\\s-]*\\))?:"
patch-version-bump-message: "^(patch|build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:"

branches:
  main:
    regex: "^main$"
    mode: ManualDeployment
    is-release-branch: true
    source-branches: [ 'develop' ]
  develop:
    regex: "^develop$"
    label: alpha
    increment: Patch
    is-release-branch: false

I use a CI Pipeline to create releases when i push something to the main branch, before i got the following versions on the main branch:

{
  "Major": 2,
  "Minor": 1,
  "Patch": 1,
  "PreReleaseTag": "",
  "PreReleaseTagWithDash": "",
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": null,
  "WeightedPreReleaseNumber": 60000,
  "BuildMetaData": 1,
  "BuildMetaDataPadded": "0001",
  "FullBuildMetaData": "1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "MajorMinorPatch": "2.1.1",
  "SemVer": "2.1.1",
  "LegacySemVer": "2.1.1",
  "LegacySemVerPadded": "2.1.1",
  "AssemblySemVer": "2.1.1.0",
  "AssemblySemFileVer": "2.1.1.0",
  "FullSemVer": "2.1.1+1",
  "InformationalVersion": "2.1.1+1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "BranchName": "main",
  "EscapedBranchName": "main",
  "Sha": "63be717f5b5b8aba0df4ba607999565c734577d9",
  "ShortSha": "63be717",
  "NuGetVersionV2": "2.1.1",
  "NuGetVersion": "2.1.1",
  "NuGetPreReleaseTagV2": "",
  "NuGetPreReleaseTag": "",
  "VersionSourceSha": "8d3aabbc270b8f4072f4c9d98877dfb91e3a7d43",
  "CommitsSinceVersionSource": 1,
  "CommitsSinceVersionSourcePadded": "0001",
  "UncommittedChanges": 1,
  "CommitDate": "2024-08-22"
} 

now i get this versions on the main branch

{
  "AssemblySemFileVer": "2.1.1.0",
  "AssemblySemVer": "2.1.1.0",
  "BranchName": "main",
  "BuildMetaData": 1,
  "CommitDate": "2024-08-22",
  "CommitsSinceVersionSource": 1,
  "EscapedBranchName": "main",
  "FullBuildMetaData": "1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "FullSemVer": "2.1.1-1+1",
  "InformationalVersion": "2.1.1-1+1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "Major": 2,
  "MajorMinorPatch": "2.1.1",
  "Minor": 1,
  "Patch": 1,
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "1",
  "PreReleaseTagWithDash": "-1",
  "SemVer": "2.1.1-1",
  "Sha": "63be717f5b5b8aba0df4ba607999565c734577d9",
  "ShortSha": "63be717",
  "UncommittedChanges": 1,
  "VersionSourceSha": "8d3aabbc270b8f4072f4c9d98877dfb91e3a7d43",
  "WeightedPreReleaseNumber": 55001
}


```### What is expected?

I would expect the semver on the mainbranch to be without the prerelease tag since its the release branch and every commit there will create a tag. 
Is this a bug or is this a new feature? 

### Steps to Reproduce

Create a git repo,  and use the config from above.

### RepositoryFixture Test

_No response_

### Output log or link to your CI build (if appropriate).

_No response_
@HHobeck
Copy link
Contributor

HHobeck commented Aug 23, 2024

Please see the following example: https://gitversion.net/docs/learn/branching-strategies/gitflow/examples

You will find this annotation:

The continuous delivery mode has been used for the main and the support branch in this examples (specified as a fallback on the root configuration layer) to illustrate how the version increments are applied. In production context the continuous deployment mode might be a better option when e.g. the release process is automated or the commits are tagged by the pipeline automatically.

and

After the feature branch is merged, the version on main is 2.0.0-5. This is due to main running in continuous delivery mode. If main was configured to use continuous deployment the version would be 2.0.0.

@HHobeck HHobeck closed this as completed Aug 23, 2024
@toadicusrex
Copy link

Please see the following example: https://gitversion.net/docs/learn/branching-strategies/gitflow/examples

You will find this annotation:

The continuous delivery mode has been used for the main and the support branch in this examples (specified as a fallback on the root configuration layer) to illustrate how the version increments are applied. In production context the continuous deployment mode might be a better option when e.g. the release process is automated or the commits are tagged by the pipeline automatically.

and

After the feature branch is merged, the version on main is 2.0.0-5. This is due to main running in continuous delivery mode. If main was configured to use continuous deployment the version would be 2.0.0.

@HHobeck I don't know whether this will make sense, but I don't want ContinuousDeployment (I want to increment the version for every commit, i.e. ContinuousDelivery) but I would like to prevent the main branch from adding the pre-release tag. Is there a way to do that? If I have a previous commit tagged as 3.7.58 and I put it on ContinuousDeployment, each commit until I change the version will result in the same version as 3.7.58. Is there a way to achieve that? Thank you @Tilusch for asking this, I'm having the same issue.

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

No branches or pull requests

3 participants