From b63275a7d28a228170ea9a02c37fbd32f0eca04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henning=20Bj=C3=B8rgo?= Date: Tue, 19 Jan 2021 18:59:14 +0100 Subject: [PATCH] Create Push.ps1 --- Push.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Push.ps1 diff --git a/Push.ps1 b/Push.ps1 new file mode 100644 index 0000000..9663563 --- /dev/null +++ b/Push.ps1 @@ -0,0 +1,14 @@ +$scriptName = $MyInvocation.MyCommand.Name +$artifacts = "./artifacts" + +if ([string]::IsNullOrEmpty($Env:NUGET_API_KEY)) { + Write-Host "${scriptName}: NUGET_API_KEY is empty or not set. Skipped pushing package(s)." +} else { + Get-ChildItem $artifacts -Filter "*.nupkg" | ForEach-Object { + Write-Host "$($scriptName): Pushing $($_.Name)" + dotnet nuget push $_ --source $Env:NUGET_URL --api-key $Env:NUGET_API_KEY + if ($lastexitcode -ne 0) { + throw ("Exec: " + $errorMessage) + } + } +}