Skip to content

Commit

Permalink
updated publish to NuGet script
Browse files Browse the repository at this point in the history
  • Loading branch information
markheath committed May 10, 2022
1 parent 8d152cb commit 80dbfee
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions publish.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
# publishes to NuGet
# $apiKey needs to be already set up with NuGet publishing key
Write-Host $PSScriptRoot

if (-not $apiKey)
{
throw "Need to set the API key first"
}

$packages = "NAudio.Core", "NAudio.Asio", "NAudio.WinForms", "NAudio.Midi",
"NAudio.WinMM", "NAudio.Wasapi", "NAudio.Uap",
"NAudio", "NAudio.Extras"

foreach ($package in $packages)
{
# publish the most recently created .nupkg file
$folder = "$package\bin\Release"
$folder = "$PSScriptRoot\$package\bin\Release"
$recent = gci "$folder\*.nupkg" | sort LastWriteTime | select -last 1
$pkg = $recent.Name
# note that this will fail with 409 error if you try to push package that already exists
dotnet nuget push "$folder\$pkg" --api-key $apiKey --source https://api.nuget.org/v3/index.json
Write-Host "publishing $pkg"
dotnet nuget push "$folder\$pkg" --api-key $apiKey --source https://api.nuget.org/v3/index.json | out-null
if (-not $?) { Write-Error "Failed to publish $pkg" }
}

0 comments on commit 80dbfee

Please sign in to comment.