35 строки
980 B
PowerShell
35 строки
980 B
PowerShell
$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) } |