-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpublish.ps1
26 lines (20 loc) · 882 Bytes
/
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
param (
[string]
[Parameter(Mandatory=$true, HelpMessage='Semantic version for the library; example: 1.0.2')]
[ValidatePattern('^\d+(\.\d+){2}(-[a-z0-9]+)?$')]
$SemVer,
[string]
$NugetApiKey
)
Push-Location (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
$nupkg = Resolve-Path "./publish/App.Metrics.Reporting.ApplicationInsights.$SemVer.nupkg" -ErrorAction Stop
$snupkg = Resolve-Path "./publish/App.Metrics.Reporting.ApplicationInsights.$SemVer.snupkg" -ErrorAction Stop
if ($NugetApiKey -eq '') {
$NugetApiKey = $env:NUGET_APIKEY_APPMETRICS
if ($NugetApiKey -eq '') {
Throw 'Missing nuget API key'
}
}
& dotnet nuget push $nupkg -k $NugetApiKey -s https://api.nuget.org/v3/index.json --skip-duplicate
& dotnet nuget push $snupkg -k $NugetApiKey -s https://api.nuget.org/v3/index.json --skip-duplicate
Pop-Location