GitVersion 发出断言版本号的许多不同部分,每个部分都可用于形成所需的版本号,但是,缩短的 sha 不是其中之一。以下是当前断言的所有变量:
{
"Major":0,
"Minor":21,
"Patch":0,
"PreReleaseTag":"",
"PreReleaseTagWithDash":"",
"PreReleaseLabel":"",
"PreReleaseNumber":"",
"BuildMetaData":"",
"BuildMetaDataPadded":"",
"FullBuildMetaData":"Branch.hotfix/0.21.1.Sha.57e16a787815c5e27c3a0edbf5224b3df64f1a69",
"MajorMinorPatch":"0.21.0",
"SemVer":"0.21.0",
"LegacySemVer":"0.21.0",
"LegacySemVerPadded":"0.21.0",
"AssemblySemVer":"0.21.0.0",
"FullSemVer":"0.21.0",
"InformationalVersion":"0.21.0+Branch.hotfix/0.21.1.Sha.57e16a787815c5e27c3a0edbf5224b3df64f1a69",
"BranchName":"hotfix/0.21.1",
"Sha":"57e16a787815c5e27c3a0edbf5224b3df64f1a69",
"NuGetVersionV2":"0.21.0",
"NuGetVersion":"0.21.0",
"CommitsSinceVersionSource":0,
"CommitsSinceVersionSourcePadded":"0000",
"CommitDate":"2017-07-14"
}
假设您正在使用某种形式的构建脚本,您可以手动缩短断言的 sha,然后将其与其他必需的变量组合以获得所需的版本号。