Skip to content

Where the PreReleaseTag number comes from? #1646

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

Closed
mniak opened this issue Mar 22, 2019 · 5 comments
Closed

Where the PreReleaseTag number comes from? #1646

mniak opened this issue Mar 22, 2019 · 5 comments

Comments

@mniak
Copy link

mniak commented Mar 22, 2019

Running gitversion on my repository returns something like this:

{
  "Major":0,
  "Minor":11,
  "Patch":0,
  "PreReleaseTag":"beta.1",
  "PreReleaseTagWithDash":"-beta.1",
  "PreReleaseLabel":"beta",
  "PreReleaseNumber":1,
  "BuildMetaData":117,
  "BuildMetaDataPadded":"0117",
  "FullBuildMetaData":"117.Branch.beta.Sha.3c108d170d4bb03626cf7f910c8bbea901a4e55d",
  "MajorMinorPatch":"0.11.0",
  "SemVer":"0.11.0-beta.1",
  "LegacySemVer":"0.11.0-beta1",
  "LegacySemVerPadded":"0.11.0-beta0001",
  "AssemblySemVer":"0.11.0.0",
  "AssemblySemFileVer":"0.11.0.0",
  "FullSemVer":"0.11.0-beta.1+117",
  "InformationalVersion":"0.11.0-beta.1+117.Branch.beta.Sha.3c108d170d4bb03626cf7f910c8bbea901a4e55d",
  "BranchName":"beta",
  "Sha":"3c108d170d4bb03626cf7f910c8bbea901a4e55d",
  "ShortSha":"3c108d1",
  "NuGetVersionV2":"0.11.0-beta0001",
  "NuGetVersion":"0.11.0-beta0001",
  "NuGetPreReleaseTagV2":"beta0001",
  "NuGetPreReleaseTag":"beta0001",
  "CommitsSinceVersionSource":117,
  "CommitsSinceVersionSourcePadded":"0117",
  "CommitDate":"2019-03-22"
}

After the beta prerelease label, comes a 1 that I cannot identify where it comes from.

Where does it come from?

I am trying to use GitVersion on Azure Devops, but since this 1 never changes, my packages are conflicting.

@mniak
Copy link
Author

mniak commented Mar 22, 2019

If only I could use the BuildMetaData instead of this mysterious 1, I would be happy.

@tpaxatb
Copy link
Contributor

tpaxatb commented Mar 22, 2019

It comes from a tag on the branch. For example you are hacking away on your beta branch getting it ready for release, that beta semver should remain 0.11.0. Up until that point, you are working on 0.11.0-beta.1 When you get to the point where you are going to send that version of the build to someone, you tag that commit "v0.11.0-beta.1". Any commits from that point on will be 0.11.0-beta.2

In other words, PreReleaseNumber is computed from the semver tags for that branch. And note, that the semver computed for the branch must actually match the tag on the branch. In other words, if you tagged it 0.12.0-beta.123 it will not catch it, because you are actually working on 0.11.0. So at the point you want to expose your beta somewhere you could potentially run on the commit you are releasing:
git tag v`GitVersion /showvariable SemVer'

@dweggemans
Copy link

dweggemans commented Apr 4, 2019

If I tag a release branch - without the v version prefix since we version without prefix - the version does not increment. @tpaxatb does this only work with the prefix? We're on 4.0.0 major.

Update: the prefix does not matter. In our case it turned out we did not fetch tags on our build server. A change in the git plugin in jenkins causes this. When we enabled fetching tags it is working as expected

@mniak
Copy link
Author

mniak commented Apr 4, 2019

Thanks.
I understood. Maybe this could be on the documentation somewhere.

@EmilAlipiev
Copy link

It comes from a tag on the branch. For example you are hacking away on your beta branch getting it ready for release, that beta semver should remain 0.11.0. Up until that point, you are working on 0.11.0-beta.1 When you get to the point where you are going to send that version of the build to someone, you tag that commit "v0.11.0-beta.1". Any commits from that point on will be 0.11.0-beta.2

In other words, PreReleaseNumber is computed from the semver tags for that branch. And note, that the semver computed for the branch must actually match the tag on the branch. In other words, if you tagged it 0.12.0-beta.123 it will not catch it, because you are actually working on 0.11.0. So at the point you want to expose your beta somewhere you could potentially run on the commit you are releasing: git tag v`GitVersion /showvariable SemVer'

this is not working like that starting from version 6? Is-mainline is removed and Is-main-branch also doesnt exist.
It keeps taking PreReleaseNumber calculated as number and adds as suffix like 1.0.0-25 and this is recognized as prerelease version.
How do you get the version without this PreReleaseNumber?

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

4 participants