forked from zacateras/sddl-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
33 lines (23 loc) · 1.25 KB
/
build.ps1
File metadata and controls
33 lines (23 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Write-Host "build: Build started"
& dotnet --info
& dotnet --list-sdks
Push-Location $PSScriptRoot
if (Test-Path .\artifacts) {
Write-Host "build: Cleaning .\artifacts"
Remove-Item .\artifacts -Force -Recurse
}
& dotnet restore --no-cache
$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 "master" -and $revision -ne "local"]
$commitHash = $(git rev-parse --short HEAD)
$buildSuffix = @{ $true = "$($suffix)-$($commitHash)"; $false = "$($branch)-$($commitHash)" }[$suffix -ne ""]
Write-Host "build: Package version suffix is '$suffix'"
Write-Host "build: Build version suffix is '$buildSuffix'"
& dotnet build --configuration Release --version-suffix=$buildSuffix
if ($LASTEXITCODE -ne 0) { exit 1 }
& dotnet test --configuration Release
if ($LASTEXITCODE -ne 0) { exit 1 }
& dotnet pack --configuration Release --version-suffix=$suffix --output "$PSScriptRoot/artifacts"
if ($LASTEXITCODE -ne 0) { exit 1 }
Pop-Location