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

[Improvement] Allow for a pre-release tag with just a number, without name #2235

Closed
carlos-vicente opened this issue Apr 19, 2020 · 4 comments · Fixed by #2249
Closed

[Improvement] Allow for a pre-release tag with just a number, without name #2235

carlos-vicente opened this issue Apr 19, 2020 · 4 comments · Fixed by #2249
Milestone

Comments

@carlos-vicente
Copy link
Contributor

carlos-vicente commented Apr 19, 2020

Is your improvement request related to a problem? Please describe.
It would be great to allow for a pre-release tag with just a number, I believe the name should not be mandatory for a correct pre-release tag.

Detailed Description

Currently we have a repo where we've been using git flow for a while now and are introducing a better versioning system with gitversion.
The release branches have the following naming: release/Release-X.Y, initially tagged with Release-X.Y.0-0, meaning this is our release candidate 0 for release X.Y.0. Each bugfix we introduce into the release branch gets tagged with Release-X.Y.0-1, Release-X.Y.0-2, Release-X.Y.0-3 and so forth.

With this configuration:

mode: ContinuousDelivery
tag-prefix: '[Rr]elease-'
assembly-versioning-scheme: MajorMinorPatchTag
assembly-file-versioning-scheme: MajorMinorPatchTag
ignore:
  sha: []
merge-message-formats: {}

Using dotnet-gitversion on version:

dotnet-gitversion /version
5.1.3+Branch.master.Sha.bef8ebc0b62b3ddd0cdafe09b66d68bbfcaf90d5

(also tested with latest version with the same result)

When getting the version on the release branches, with those tags, this is what we get (some fields omitted):

{
  "Major":5,
  "Minor":13,
  "Patch":0,
  "PreReleaseTag":".10",
  "PreReleaseTagWithDash":"",
  "PreReleaseLabel":"",
  "PreReleaseNumber":"",
  "WeightedPreReleaseNumber":"",
  "BuildMetaData":"",
  "BuildMetaDataPadded":"",
  "MajorMinorPatch":"5.13.0",
  "SemVer":"5.13.0",
  "LegacySemVer":"5.13.0",
  "LegacySemVerPadded":"5.13.0",
  "AssemblySemVer":"5.13.0.10",
  "AssemblySemFileVer":"5.13.0.10",
  "FullSemVer":"5.13.0",
}

this is what we expected to get:

{
  "Major":5,
  "Minor":13,
  "Patch":0,
  "PreReleaseTag":10,
  "PreReleaseTagWithDash":-10,
  "PreReleaseLabel":"",
  "PreReleaseNumber":10,
  "WeightedPreReleaseNumber":10,
  "BuildMetaData":"",
  "BuildMetaDataPadded":"",
  "MajorMinorPatch":"5.13.0",
  "SemVer":"5.13.0-10",
  "LegacySemVer":"5.13.0-10",
  "LegacySemVerPadded":"5.13.0-0010",
  "AssemblySemVer":"5.13.0.10",
  "AssemblySemFileVer":"5.13.0.10",
  "FullSemVer":"5.13.0-10",
}

Context

This is very important to us as it would prevent us from adding a name to the pre-release tag we do not need. As defined in https://semver.org/#spec-item-9 the pre-release identifier can be just numeric.

Possible Implementation

From my investigations the pre-release tag parsing is already supporting this, the only change required would be to checking that a pre-release part has in fact a tag and allowing for a correct formatting. I've forked the repo and made such modifications (https://github.com/carlos-vicente/GitVersion), opening this issue before the PR to get your thoughts on this.

@carlos-vicente
Copy link
Contributor Author

Can anyone have a look at this, please?

@asbjornu
Copy link
Member

@carlos-vicente, are all other tests passing after you've implemented support for this? If so, this sounds like a reasonable change. Please submit the PR if tests are passing. Please also add a test for this new behaviour if you haven't already.

@carlos-vicente
Copy link
Contributor Author

Just opened #2249

@arturcic arturcic added this to the 5.3.0 milestone Apr 30, 2020
@github-actions
Copy link

github-actions bot commented May 4, 2020

🎉 This issue has been resolved in version 5.3.0 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants