-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.ps1
44 lines (38 loc) · 1.38 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
43
44
[cmdletbinding()]
param(
[ValidateSet('Default', 'Build', 'Analyze', 'Test', 'WinZip')]
$Task = 'Default'
)
Write-Host "Importing Modules:" -ForegroundColor Yellow
$Modules = @('Psake', 'BuildHelpers', 'Pester', 'PSScriptAnalyzer', 'PSDeploy')
ForEach ($Module in $Modules) {
Write-Host "...$Module" -ForegroundColor Yellow
try {
$InstallModuleParams = @{
Name = $Module
Scope = 'CurrentUser'
Force = $true
}
if ($Module -eq 'Pester') {
$InstallModuleParams.SkipPublisherCheck = $true
}
$null = Find-Module $Module -ErrorAction Stop
$null = Install-Module @InstallModuleParams
Write-Host "...Importing" -ForegroundColor Green
Import-Module $Module
Write-Host "...Complete" -ForegroundColor Green
}
catch {
Write-Host "...Not Found!" -ForegroundColor Red
Write-Error -Message $_ -ErrorAction Stop
}
}
Write-Host "Completed Importing Modules`r`n" -ForegroundColor Green
Push-Location $PSScriptRoot
Write-Verbose "Cleaning current Build variables"
Get-ChildItem -Path env:\bh* | Remove-Item
Write-Verbose "Setting Build Variables"
Set-BuildEnvironment
Write-Host "Executing PSake Build`r`n" -ForegroundColor Green
Invoke-Psake -buildFile .\psake.ps1 -properties $PSBoundParameters -noLogo -taskList $Task
exit ( [int]( -not $psake.build_success ) )