-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.ps1
46 lines (29 loc) Β· 1.18 KB
/
publish.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
function WriteLine($value) {
Write-Output "`n$value"
}
WriteLine("Running dotnet build...")
$buildOutput = [string](dotnet.exe build .\BugSplatDotNetStandard\BugSplatDotNetStandard.csproj --no-incremental -c Release)
WriteLine("$buildOutput")
$buildSuccess = $buildOutput -match "Build succeeded"
if (-not $buildSuccess) {
throw 'Build failed'
}
$buildOutput -match "Successfully created package '(.*)'"
$nupkgPath = $Matches[1];
WriteLine("Signing $nupkgPath...")
# Requires folder containing nuget.exe be added to PATH
# https://www.nuget.org/downloads
$signOutput = [string](nuget.exe sign $nupkgPath -CertificatePath .\BugSplat.pfx -Timestamper http://timestamp.comodoca.com/)
WriteLine("$signOutput")
$signSuccess = $signOutput.Contains("Package(s) signed successfully.")
if (-not $signSuccess) {
throw 'Code signing failed'
}
WriteLine("Publishing $nupkgPath...")
$publishOutput = [string](dotnet nuget push $nupkgPath --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json)
WriteLine("$publishOutput")
$publishSuccess = $publishOutput.Contains("Your package was pushed.");
if (-not $publishSuccess) {
throw 'Publish failed'
}
WriteLine("Great success!")