-
Notifications
You must be signed in to change notification settings - Fork 437
/
build.ps1
35 lines (29 loc) · 980 Bytes
/
build.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
$buildFolderPath = Join-Path $PSScriptRoot "build"
if (-not (Test-Path $buildFolderPath))
{
throw "Build folder '$buildFolderPath' does not exist."
}
Set-Location $buildFolderPath
$buildCommand = $null
$isReleaseBuild = $null
if (-not([bool]::TryParse($env:IsReleaseBuild, [ref] $isReleaseBuild)))
{
throw "IsReleaseBuild can only be set to true or false."
}
if ($env:IntegrationBuildNumber)
{
if (-not ($env:IntegrationBuildNumber -like "PreRelease*-*"))
{
$integrationBuildNumberExample = "PreRelease" + (Get-Date -Format "yyMMdd-HHmm")
$errorMessage = "IntegrationBuildNumber '$env:IntegrationBuildNumber' format is invalid. It should be of the form '$integrationBuildNumberExample'."
throw $errorMessage
}
$buildCommand = { dotnet run --integrationTests }
}
else
{
$buildCommand = { dotnet run --ci }
}
Write-Host "Running $buildCommand"
& $buildCommand
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }