-
Notifications
You must be signed in to change notification settings - Fork 1
/
.build.ps1
47 lines (39 loc) · 1.1 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
45
46
47
<#
.Synopsis
Build script, https://github.com/nightroman/Invoke-Build
#>
Set-StrictMode -Version Latest
$ModuleName = 'FarMongo'
# Synopsis: Remove temp files.
task clean {
remove z
}
# Synopsis: Set $script:Version.
task version {
($script:Version = switch -Regex -File Release-Notes.md {'##\s+v(\d+\.\d+\.\d+)' {$Matches[1]; break} })
}
# Synopsis: Make the package in z\$ModuleName.
task package version, {
remove z
$null = mkdir z\$ModuleName\Scripts
Copy-Item -Destination z\$ModuleName\Scripts -Path $(
'Scripts\*'
)
Copy-Item -Destination z\$ModuleName -LiteralPath $(
"about_$ModuleName.help.txt"
"$ModuleName.psd1"
"$ModuleName.psm1"
'LICENSE'
)
# set module version
Import-Module PsdKit
$xml = Import-PsdXml z\$ModuleName\$ModuleName.psd1
Set-Psd $xml $Version 'Data/Table/Item[@Key="ModuleVersion"]'
Export-PsdXml z\$ModuleName\$ModuleName.psd1 $xml
}
# Synopsis: Make and push the PSGallery package.
task pushPSGallery package, {
$NuGetApiKey = Read-Host NuGetApiKey
Publish-Module -Path z\$ModuleName -NuGetApiKey $NuGetApiKey
},
clean