-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
42 lines (37 loc) · 1.03 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
40
41
42
[CmdletBinding()]
param (
# The task to pass to the psake build script.
[Parameter(Mandatory = $false)]
[ValidateSet('Clean', 'Build', 'Sign', 'BuildHelp', 'Install', 'Test', 'Publish')]
[String]
$Task = 'Test',
# NuGet API key used during publishing.
[Parameter(Mandatory = $false)]
[String]
$NuGetApiKey
)
begin {
$ConfirmPreference = 'None'
$ProgressPreference = 'SilentlyContinue'
$ErrorActionPreference = 'Stop'
if ($Task -eq 'Publish') {
if (-not [Boolean](Get-PSRepository -Name 'PSGallery' -ErrorAction SilentlyContinue)) {
Register-PSRepository -Default
}
}
}
end {
$parameters = @{
buildFile = "$PSScriptRoot\build.psake.ps1"
taskList = $Task
nologo = $true
notr = $true
Verbose = $VerbosePreference
}
if ($NuGetApiKey) {
$parameters.Add('NuGetApiKey', $NuGetApiKey)
}
Write-Verbose -Message "Executing '$Task' task."
Invoke-psake @parameters
exit !$psake.build_success
}