From ffcdd8f82c8c17f175b695d73a5dae8e8b70b3d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Tue, 29 Nov 2022 21:43:05 +0100 Subject: [PATCH] Ignore `git` if not installed when running `build.ps1` --- scripts/build.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index aa04f44..1f0a654 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -11,14 +11,16 @@ if ($args[1]) { } $majorVer = Get-Content VERSION -$lastVer = git tag --sort version:refname --list "$majorVer.*" | Select -last 1 +if (Get-Command "git.exe" -ErrorAction SilentlyContinue) { + $lastVer = git tag --sort version:refname --list "$majorVer.*" | Select -last 1 +} echo "Configuration: $configuration" echo "BuildPath: $path" echo "Major: $majorVer" echo "lastVer: $lastVer" -if ($lastVer -ne "") { +if ($lastVer) { $nextVer = $lastVer.Split('.') $lastItem = $nextVer.Length-1 $nextVer[$lastItem] = [int]$nextVer[$lastItem] + 1 @@ -26,6 +28,7 @@ if ($lastVer -ne "") { } else { $nextVer="$majorVer.0" } +echo "nextVer: $nextVer" dotnet --list-sdks -or winget install Microsoft.DotNet.SDK.6 dotnet build --configuration "$configuration" "/property:Version=$nextVer" --output "$path"