-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy path1.build.ps1
More file actions
97 lines (83 loc) · 2.4 KB
/
Copy path1.build.ps1
File metadata and controls
97 lines (83 loc) · 2.4 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<#
.Synopsis
Build script, https://github.com/nightroman/Invoke-Build
#>
Set-StrictMode -Version 3
# Synopsis: Remove temp files.
task clean {
remove z, README.html, *.nupkg
}
# Synopsis: Convert markdown to HTML.
task markdown {
exec { pandoc.exe --standalone --from=gfm --output=README.html README.md --metadata=pagetitle=README }
}
# Synopsis: Set $script:Version.
task version {
($script:Version = switch -File Release-Notes.md -Regex {'##\s+v(\d+\.\d+\.\d+)' {$Matches[1]; break}})
}
# Synopsis: Push with a version tag.
task pushRelease version, {
assert (!(exec { git status --short })) "Commit changes."
exec { git push }
exec { git tag -a "v$Version" -m "v$Version" }
exec { git push origin "v$Version" }
}
# Synopsis: Push NuGet package.
task pushNuGet nuget, {
$NuGetApiKey = Read-Host NuGetApiKey
exec { nuget.exe push "PowerShelf.$Version.nupkg" -Source nuget.org -ApiKey $NuGetApiKey }
},
clean
# Synopsis: Copy files to z\tools.
task package markdown, {
remove z
$null = mkdir z\tools
Copy-Item -Destination z @(
'README.md'
)
Copy-Item -Destination z\tools @(
'*-*.ps1'
'LICENSE'
'README.html'
)
}
# Synopsis: Make NuGet package.
task nuget package, version, {
Set-Content z\Package.nuspec @"
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>PowerShelf</id>
<version>$Version</version>
<authors>Roman Kuzmin</authors>
<owners>Roman Kuzmin</owners>
<developmentDependency>true</developmentDependency>
<license type="expression">Apache-2.0</license>
<readme>README.md</readme>
<projectUrl>https://github.com/nightroman/PowerShelf</projectUrl>
<description>PowerShell tools for various tasks implemented as scripts, mostly standalone.</description>
<releaseNotes>https://github.com/nightroman/PowerShelf/blob/main/Release-Notes.md</releaseNotes>
<tags>NuGet PowerShell Debugging Tracing Coverage Tools</tags>
</metadata>
</package>
"@
exec { nuget.exe pack z\Package.nuspec -NoPackageAnalysis }
}
task docs {
$text = $(
'# PowerShelf Scripts'
''
foreach($item in Get-ChildItem *-*.ps1) {
$name = $item.Name
Convert-HelpToDocs.ps1 $item "docs/$name.md"
$r = Get-Help $name
"- [$name]($name.md) - $(@($r.Synopsis -split '\r?\n')[0])"
}
) -join "`n"
Set-Content docs/README.md $text
}
# Synopsis: Release changes.
task release pushNuGet, pushRelease -If {
Assert-GitBranchClean.ps1
$true
}