Skip to content

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

Open
@rdanilin

Description

@rdanilin

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"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions