Skip to content

Commit 947f03d

Browse files
authored
Update version.ps1 (#574)
1 parent b2bf595 commit 947f03d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Versioning/version.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ $branchName = $ENV:BRANCH_NAME
55
Write-Host "Build Salt: $buildSalt"
66
Write-Host "Branch Name: $branchName"
77

8-
$gitSimpleVersion = git describe --tags --abbrev=0
8+
$gitSimpleVersion = git describe --tags --abbrev=0 2>$null
9+
if (!$gitSimpleVersion) {
10+
Write-Host "No tags found in the repository. Using default version."
11+
$gitSimpleVersion = "0.0.1" # Default version
12+
}
13+
914
$simpleVersionStandard = echo $gitSimpleVersion | Select-String -Pattern "([0-9]+)\.([0-9]+)\.([0-9]+)" | % {$_.Matches} | %{$_.Groups[1].Value+"."+$_.Groups[2].Value+"."+$_.Groups[3].Value}
1015
$dotNetVersion = "$simpleVersionStandard.$buildSalt"
1116
$infoVersion = -join(("$gitSimpleVersion" -replace "([0-9]+)\.([0-9]+)\.([0-9]+)","$dotNetVersion"), "-", "$branchName")

0 commit comments

Comments
 (0)