-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.ps1
44 lines (38 loc) · 1.3 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
#!/usr/bin/powershell -Command
<#
.Description
Installs and loads all the required modules for the build.
Derived from scripts written by Warren F. (RamblingCookieMonster)
#>
[cmdletbinding()]
param (
[ValidateSet('Default', 'Build', 'Pester', 'Clean')]
$Task = 'Default'
)
Write-Output "Starting build"
# Cleans out old versions of modules from CurrentUser, run as admin to remove System installed Modules
if (
$null -eq $ENV:BHBuildSystem -or
$null -eq $ENV:BHBranchName -or
$null -eq $ENV:BHCommitMessage
) {
Write-Output " Remove Duplicate and Old Dependent Modules"
.\build.clean.modules.ps1
}
# Grab nuget bits, install modules, set build variables, start build.
Write-Output " Install Dependent Modules"
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
Install-Module InvokeBuild, PSDeploy, BuildHelpers, PSScriptAnalyzer, PowerShellForGitHub -force -Scope CurrentUser
Install-Module Pester -Force -SkipPublisherCheck -Scope CurrentUser
Write-Output " Import Dependent Modules"
Import-Module InvokeBuild, BuildHelpers, PSScriptAnalyzer, PowerShellForGitHub
Set-BuildEnvironment
Write-Output " InvokeBuild"
Invoke-Build $Task -Result result
if ($Result.Error) {
Get-ChildItem -Path .\ProxmoxCLI\ -Filter "*.ps1" -Recurse | Invoke-ScriptAnalyzer
exit 1
}
else {
exit 0
}