forked from Azure/azure-functions-core-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
39 lines (33 loc) · 1.04 KB
/
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
36
37
38
39
$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 }
}
elseif ($isReleaseBuild)
{
$buildCommand = { dotnet run --ci --generateSBOM }
}
else
{
$buildCommand = { dotnet run --ci }
}
Write-Host "Running $buildCommand"
& $buildCommand
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }