diff --git a/Build.ps1 b/Build.ps1 index c265894..a1bca20 100644 --- a/Build.ps1 +++ b/Build.ps1 @@ -12,16 +12,24 @@ if(Test-Path .\artifacts) { $branch = @{ $true = $env:APPVEYOR_REPO_BRANCH; $false = $(git symbolic-ref --short -q HEAD) }[$env:APPVEYOR_REPO_BRANCH -ne $NULL]; $revision = @{ $true = "{0:00000}" -f [convert]::ToInt32("0" + $env:APPVEYOR_BUILD_NUMBER, 10); $false = "local" }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; $suffix = @{ $true = ""; $false = "$($branch.Substring(0, [math]::Min(10,$branch.Length)))-$revision"}[$branch -eq "main" -and $revision -ne "local"] +$commitHash = $(git rev-parse --short HEAD) +$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""] -echo "build: Version suffix is $suffix" +echo "build: Package version suffix is $suffix" +echo "build: Build version suffix is $buildSuffix" foreach ($src in ls src/*) { Push-Location $src echo "build: Packaging project in $src" - & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix -p:ContinuousIntegrationBuild=true - if($LASTEXITCODE -ne 0) { exit 1 } + & dotnet build -c Release --version-suffix=$buildSuffix -p:ContinuousIntegrationBuild=true + if ($suffix) { + & dotnet pack -c Release -o ..\..\artifacts --version-suffix=$suffix --no-build + } else { + & dotnet pack -c Release -o ..\..\artifacts --no-build + } + if($LASTEXITCODE -ne 0) { throw "build failed" } Pop-Location }