Skip to content

Commit

Permalink
Merge pull request majkinetor#168 from galeksandrp/push-url-from-env
Browse files Browse the repository at this point in the history
Set push_url from environment
  • Loading branch information
majkinetor authored Oct 4, 2018
2 parents 2154934 + 6353a21 commit 39636fb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions AU/Public/Push-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ function Push-Package() {
elseif (Test-Path ..\api_key) { gc ..\api_key }
elseif ($Env:api_key) { $Env:api_key }

$push_url = if ($Env:au_PushUrl) { $Env:au_PushUrl }
else { 'https://push.chocolatey.org' }

$packages = ls *.nupkg | sort -Property CreationTime -Descending
if (!$All) { $packages = $packages | select -First 1 }
if (!$packages) { throw 'There is no nupkg file in the directory'}
if ($api_key) {
$packages | % { cpush $_.Name --api-key $api_key --source https://push.chocolatey.org }
$packages | % { cpush $_.Name --api-key $api_key --source $push_url }
} else {
$packages | % { cpush $_.Name --source https://push.chocolatey.org }
$packages | % { cpush $_.Name --source $push_url }
}
}

0 comments on commit 39636fb

Please sign in to comment.