Skip to content

Commit

Permalink
🚨 Fixes Version Calculation for Test Builds
Browse files Browse the repository at this point in the history
  • Loading branch information
brucificus committed Dec 18, 2024
1 parent 45cbe19 commit 849f310
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion build/package-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,19 @@ elseif (Get-Command gitversion -ErrorAction SilentlyContinue) {
if ($gitversion_bin) {
[PSObject] $versionInfo = & $gitversion_bin | ConvertFrom-Json

[string] $PackageVersion = $versionInfo | Select-Object -ExpandProperty NuGetVersionV2
[string] $paddedNumberFormatPattern = "0000"
[string] $prereleaseLabelShortened = ($versionInfo.PreReleaseLabel.Length -gt 16) ? $versionInfo.PreReleaseLabel.Substring(0, 16) : $versionInfo.PreReleaseLabel
# TODO: Verify 'PreReleaseNumber' is correct suffix. Ambiguous from historical documentation found at https://github.com/GitTools/GitVersion/blob/v4.0.0/docs/more-info/variables.md.
[Nullable[int]] $preReleaseNumber = $versionInfo.PreReleaseNumber -as [int]
if ($preReleaseNumber -and $versionInfo.PreReleaseLabel) {
[string] $LegacySemVer = $versionInfo.MajorMinorPatch + "-" + $versionInfo.PreReleaseLabel + $preReleaseNumber
[string] $LegacySemVerPadded = $versionInfo.MajorMinorPatch + "-" + $prereleaseLabelShortened + $preReleaseNumber.ToString($paddedNumberFormatPattern)
} else {
[string] $LegacySemVer = $versionInfo.MajorMinorPatch
[string] $LegacySemVerPadded = $versionInfo.MajorMinorPatch
}
[string] $PackageVersion = $LegacySemVerPadded

[string] $PackageVersionPrereleaseTag = $versionInfo | Select-Object -ExpandProperty PreReleaseTag
[string] $assemblySemVer = $versionInfo | Select-Object -ExpandProperty AssemblySemVer
[string] $CommitSha = $versionInfo | Select-Object -ExpandProperty Sha
Expand Down

0 comments on commit 849f310

Please sign in to comment.