forked from devblackops/psake-github-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.ps1
26 lines (22 loc) · 842 Bytes
/
entrypoint.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
#requires -modules psake, PSDepend, BuildHelpers
[cmdletbinding()]
param(
# Build task(s) to execute
[string[]]$Task = 'default'
)
# psake and PSDepend files
if (-not $env:PSAKE_FILE) {$env:PSAKE_FILE = './psakeFile.ps1'}
if (-not $env:PSDEPEND_FILE) {$env:PSDEPEND_FILE = './requirements.psd1'}
# Bootstrap dependencies...or not
if (($env:SKIP_REQS -ne 'true' -and $env:SKIP_REQS -ne 1) -and (Test-Path -Path $env:PSDEPEND_FILE)) {
Invoke-PSDepend -Path $env:PSDEPEND_FILE -Install -Import -Force -WarningAction SilentlyContinue -ErrorAction Stop
}
# Execute psake task(s)
if (Test-Path -Path $env:PSAKE_FILE) {
Invoke-psake -buildFile $env:PSAKE_FILE -taskList $Task -nologo
if (-not $psake.build_success) {
throw 'psake failed'
}
} else {
throw "Could not find psake file [$env:PSAKE_FILE]"
}