Skip to content

Commit

Permalink
Create Push.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjorgo authored Jan 19, 2021
1 parent 4c9b4f2 commit b63275a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Push.ps1
Original file line number Diff line number Diff line change
@@ -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)
}
}
}

0 comments on commit b63275a

Please sign in to comment.