-
Notifications
You must be signed in to change notification settings - Fork 33
/
build-ci.ps1
38 lines (29 loc) · 1.25 KB
/
build-ci.ps1
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
34
35
36
37
38
$ErrorActionPreference = 'Stop'
$dotnet = Get-Command dotnet
$rawVersionInfo = & $dotnet gitversion
If ($LASTEXITCODE) {
Write-Host 'GitVersion:'
Write-Host $rawVersionInfo
Exit 1
}
$versionInfo = $rawVersionInfo | ConvertFrom-Json
$versionPrefix = $versionInfo.MajorMinorPatch
$versionSuffix = $versionInfo.NuGetPreReleaseTagV2
$informationalVersion = $versionInfo.InformationalVersion
If ($versionSuffix) {
Write-Host "Build version is $versionPrefix-$versionSuffix"
} Else {
Write-Host "Build version is $versionPrefix"
}
Write-Host '====================='
Write-Host 'Restoring packages...'
Write-Host '====================='
& $dotnet restore /p:VersionPrefix="$versionPrefix" /p:VersionSuffix="$versionSuffix" /p:AssemblyInformationalVersion="$informationalVersion"
Write-Host '==========='
Write-Host 'Building...'
Write-Host '==========='
& $dotnet build /p:VersionPrefix="$versionPrefix" /p:VersionSuffix="$versionSuffix" /p:AssemblyInformationalVersion="$informationalVersion" --no-restore
Write-Host '=========='
Write-Host 'Packing...'
Write-Host '=========='
& $dotnet pack /p:VersionPrefix="$versionPrefix" /p:VersionSuffix="$versionSuffix" /p:AssemblyInformationalVersion="$informationalVersion" --no-restore --include-symbols -o "$PWD\out"