Skip to content

Commit

Permalink
Merge pull request #24 from serilog/dev
Browse files Browse the repository at this point in the history
Updated build script
  • Loading branch information
nblumhardt committed Jun 14, 2024
2 parents 2168306 + a973088 commit a6c1b7b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a6c1b7b

Please sign in to comment.