Skip to content

Commit b13df02

Browse files
committed
Fix nuget pack script for normal version
1 parent 5170371 commit b13df02

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Scripts/pack-nuget.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@
99

1010
$revision = git describe --always --tags --exclude latest
1111

12-
if ($revision -match '^(\d+\.\d+\.\d+)-(\d+)(?:-g[0-9a-f]+)?$') {
12+
if ($revision -match '^(\d+\.\d+\.\d+)(?:-(\d+)(?:-g[0-9a-f]+)?)?$') {
1313
$baseVersion = $matches[1]
1414
$commitCount = $matches[2]
15-
$revision = "$baseVersion-preview$commitCount"
15+
if ($commitCount) {
16+
$revision = "$baseVersion-preview$commitCount"
17+
} else {
18+
$revision = $baseVersion
19+
}
1620
} else {
17-
$revision = $gitVersion # fallback
21+
throw "Unsupported git describe output: '$revision'. Expected 'x.y.z' or 'x.y.z-N-g<sha>'."
1822
}
1923

2024
Write-Host "NuGet Package Version: $revision"

0 commit comments

Comments
 (0)