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

Enable support for {Sha} and {ShortSha} variables inside tag property #3035

Open
rdanilin opened this issue Mar 7, 2022 · 4 comments
Open
Milestone

Comments

@rdanilin
Copy link

rdanilin commented Mar 7, 2022

Is your improvement request related to a problem? Please describe.

It would be nice to have a support for {Sha} / {ShortSha} variables inside 'tag' property in GitVersion.yml.

Detailed Description

I'm trying to generate a version which contains a commit hash, but seems like that does not support by GitVersion tool.

Below my configuration and output:

mode: ContinuousDelivery
branches:
  develop:
    tag: ''
    regex: ^develop
  feature:
    regex: ^feature[/-]
    tag: 'ci.{ShortSha}'

Output:

{
  "Major": 1,
  "Minor": 1,
  "Patch": 0,
  "PreReleaseTag": "ci.{ShortSha}.1",
  "PreReleaseTagWithDash": "-ci.{ShortSha}.1",
  "PreReleaseLabel": "ci.{ShortSha}",
  "PreReleaseLabelWithDash": "-ci.{ShortSha}",
  "PreReleaseNumber": 1,
  "WeightedPreReleaseNumber": 30001,
  "BuildMetaData": 1,
  "BuildMetaDataPadded": "0001",
  "FullBuildMetaData": "1.Branch.feature-my-feature.Sha.bab86bbaa91a9d09a53c4f8767d5cf6be05ac4eb",
  "MajorMinorPatch": "1.1.0",
  "SemVer": "1.1.0-ci.{ShortSha}.1",
  "LegacySemVer": "1.1.0-ci{ShortSha}1",
  "LegacySemVerPadded": "1.1.0-ci{ShortSha}0001",
  "AssemblySemVer": "1.1.0.0",
  "AssemblySemFileVer": "1.1.0.0",
  "FullSemVer": "1.1.0-ci.{ShortSha}.1+1",
  "InformationalVersion": "1.1.0-ci.{ShortSha}.1+1.Branch.feature-my-feature.Sha.bab86bbaa91a9d09a53c4f8767d5cf6be05ac4eb",
  "BranchName": "feature/my-feature",
  "EscapedBranchName": "feature-my-feature",
  "Sha": "bab86bbaa91a9d09a53c4f8767d5cf6be05ac4eb",
  "ShortSha": "bab86bb",
  "NuGetVersionV2": "1.1.0-ci{shortsha}0001",
  "NuGetVersion": "1.1.0-ci{shortsha}0001",
  "NuGetPreReleaseTagV2": "ci{shortsha}0001",
  "NuGetPreReleaseTag": "ci{shortsha}0001",
  "VersionSourceSha": "3522c8f7d00f0607a3e096c8752870599cab2c8f",
  "CommitsSinceVersionSource": 1,
  "CommitsSinceVersionSourcePadded": "0001",
  "UncommittedChanges": 0,
  "CommitDate": "2022-03-07"
}
@asbjornu
Copy link
Member

asbjornu commented Mar 7, 2022

#2179 added support for formatting GitVersion properties, but custom formatting is reserved for the various -format configuration properties and is not supported in tag. Adding a tag-format property may be up for discussion, though.

@github-actions
Copy link

github-actions bot commented Mar 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Mar 4, 2023
@HHobeck HHobeck removed the stale label Apr 1, 2023
@HHobeck HHobeck added this to the 6.x milestone Apr 1, 2023
@waderobson
Copy link

I would love to see this feature. We are versioning using the shortsha on our feature branches currently and it would be great if gitversion SemVer could be configured to return 1.2.3 on main and 1.2.3-shortsha on feature.

Looks like if this was supported I would still be getting a PreReleaseNumber tacked on the end. Not sure if there is anyway to format the PreReleaseTag to return just {MajorMinorPatch}-{ShortSha}

@arturcic arturcic added stale and removed stale labels Jun 30, 2023
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Sep 29, 2023
@arturcic arturcic removed the stale label Sep 29, 2023
@arturcic arturcic added stale and removed stale labels Oct 30, 2023
@HHobeck HHobeck modified the milestones: 6.x, 7.x Jan 11, 2024
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

5 participants