-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.ps1
More file actions
47 lines (40 loc) · 1.19 KB
/
build.ps1
File metadata and controls
47 lines (40 loc) · 1.19 KB
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
45
46
47
<#
.Description
Installs and loads all the required modules for the build.
Derived from scripts written by Warren F. (RamblingCookieMonster)
#>
[CmdletBinding()]
param (
$Task = 'Default'
)
Write-Output "Starting build"
# Grab nuget bits, install modules, set build variables, start build.
Write-Output " Install Dependent Modules"
Get-PackageProvider -Name NuGet -ForceBootstrap | Out-Null
Write-Output 'Installing BuildHelpers to assist with build process.'
Install-Module 'BuildHelpers' -force -Scope CurrentUser
$null = Set-BuildEnvironment -Path "$PSScriptRoot\PSRedgate" -Force
$environmentDetails = Get-BuildEnvironmentDetail
$modules = @('InvokeBuild', 'PSDeploy', 'BuildHelpers', 'PSScriptAnalyzer', 'Pester')
Write-Output " Installing and importing dependent modules."
foreach ($module in $modules)
{
if ($module -notin $environmentDetails.ModulesAvailable.Name)
{
Install-Module $module -SkipPublisherCheck -Force -Scope CurrentUser
}
if ($module -notin $environmentDetails.ModulesLoaded.Name)
{
Import-Module $module -Force
}
}
Write-Output " InvokeBuild"
Invoke-Build $Task -Result result
if ($Result.Error)
{
exit 1
}
else
{
exit 0
}