-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpsake.ps1
50 lines (41 loc) · 1.17 KB
/
psake.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
45
46
47
48
49
Properties {
$ModuleName = (Get-Item $PSScriptRoot\*.psd1)[0].BaseName
$Exclude = @(
'psake.ps1',
'.git',
'.gitignore'
'publish',
'.vscode'
'_config.yml'
)
$TempDir = "$home/tmp"
$PublishDir = "$PSScriptRoot/publish/$ModuleName"
}
Task default -depends Build
Task Publish -depends Build {
# Write-Host "test publish = $testpublish"
if ($testpublish -eq "yes") {
$whatIf = $true
} else {
$whatIf = $false
}
# Write-Host "whatif = $whatIf"
$NugetKey = (Get-Secret -Name NuGetKey -AsPlainText | ConvertFrom-Json).NuGetKey
Publish-PSResource -Path $PublishDir -ApiKey $NugetKey -WhatIf:$WhatIf -Verbose
}
Task Build -depends Clean {
# Generate updated reference page
# . $PSScriptRoot/docs/makeDocs.ps1
Copy-Item "$PSScriptRoot\*" -Destination $PublishDir -Exclude $Exclude -Recurse
}
Task Clean -depends Init {
Remove-Item "$PublishDir\*" -Recurse -Force
}
Task Init {
if (-not (Test-Path $TempDir)) {
New-Item -ItemType Directory $TempDir
}
if (-not (Test-Path $PublishDir)) {
New-Item -ItemType Directory $PublishDir
}
}