-
Notifications
You must be signed in to change notification settings - Fork 13
/
Build.ps1
34 lines (29 loc) · 1.35 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
# Taken from psake https://github.com/psake/psake
<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
#>
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
& $cmd
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
exec { & dotnet restore }
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$revision = "{0:D}" -f [convert]::ToInt32($revision, 10)
exec { & dotnet publish -c Release -r win10-x64 -o .\artifacts/win10-x64 --version-suffix=$revision }
exec { & dotnet publish -c Release -r osx.10.10-x64 -o .\artifacts/osx.10.10-x64 --version-suffix=$revision }
exec { & dotnet publish -c Release -r ubuntu.14.04-x64 -o .\artifacts/ubuntu.14.04-x64 --version-suffix=$revision }