forked from WahlNetwork/vester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
35 lines (31 loc) · 1.17 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
[cmdletbinding()]
Param (
[string]$ApiKey,
[string[]]$PowerShellModules = @("Pester","Psake","BuildHelpers","Plaster"),
[string[]]$PackageProviders = @('NuGet','PowerShellGet'),
[string[]]$TaskList
)
# Install package providers for PowerShell Modules
ForEach ($Provider in $PackageProviders) {
If (!(Get-PackageProvider $Provider -ErrorAction SilentlyContinue)) {
Install-PackageProvider $Provider -Force -ForceBootstrap -Scope CurrentUser
}
}
# Install the PowerShell Modules
ForEach ($Module in $PowerShellModules) {
If (!(Get-Module -ListAvailable $Module -ErrorAction SilentlyContinue)) {
Install-Module $Module -Scope CurrentUser -Force -Repository PSGallery
}
Import-Module $Module
}
Push-Location $PSScriptRoot
Write-Output "Retrieving Build Variables"
Get-ChildItem -Path env:\bh* | Remove-Item
Set-BuildEnvironment
If ($TaskList.Count -gt 0) {
Write-Output "Executing Tasks: $TaskList`r`n"
Invoke-Psake -buildFile .\psake.ps1 -properties $PSBoundParameters -noLogo -taskList $TaskList
} Else {
Write-Output "Executing Unit Tests Only`r`n"
Invoke-Psake -buildFile .\psake.ps1 -properties $PSBoundParameters -nologo
}