-
Notifications
You must be signed in to change notification settings - Fork 1
/
Build.ps1
37 lines (29 loc) · 1.01 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
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
echo "Exec: $cmd"
& $cmd
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}
echo "build: Build started"
$projectsToDeploy = @("src/WaCore.Data.Ef", "src/WaCore.Web", "src/WaCore.Crud.Data.Ef", "src/WaCore.Crud.Services")
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
echo "build: Restore packages"
exec { & dotnet restore .\src }
exec { & dotnet build -c Release .\src }
if ($env:APPVEYOR_REPO_TAG -eq "true") {
$buildVersion = $env:APPVEYOR_REPO_TAG_NAME
echo "NuGet pack version: $buildVersion"
foreach ($src in $projectsToDeploy) {
Push-Location $src
echo "build: Pack project in $src"
exec { & dotnet pack -c Release -o ..\..\artifacts /p:PackageVersion=$buildVersion }
Pop-Location
}
}