pass nugetkey as param (#8461)

This commit is contained in:
Travis Plunk
2018-12-13 17:23:41 -08:00
committed by GitHub
parent 80a5be921d
commit 20d9bd5f0a
4 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ jobs:
- powershell: |
$ErrorActionPreference = 'continue'
tools/travis.ps1
tools/travis.ps1 -NugetKey $(NUGET_KEY)
displayName: Build and test
condition: succeeded()
+1 -1
View File
@@ -94,6 +94,6 @@ steps:
- powershell: |
Import-Module .\tools\Appveyor.psm1
Restore-PSOptions
Invoke-AppveyorFinish
Invoke-AppveyorFinish -NuGetKey $(NUGET_KEY)
displayName: Finish
condition: eq(variables['Purpose'], 'ElevatedPesterTests_xUnit_Packaging')
+6 -2
View File
@@ -579,6 +579,10 @@ function Get-ReleaseTag
# Implements AppVeyor 'on_finish' step
function Invoke-AppveyorFinish
{
param(
[string] $NuGetKey
)
try {
$releaseTag = Get-ReleaseTag
@@ -664,10 +668,10 @@ function Invoke-AppveyorFinish
Write-Warning "Artifact $_ does not exist."
}
if($env:NUGET_KEY -and $env:NUGET_URL -and [system.io.path]::GetExtension($_) -ieq '.nupkg')
if($NuGetKey -and $env:NUGET_URL -and [system.io.path]::GetExtension($_) -ieq '.nupkg')
{
Write-Log "pushing $_ to $env:NUGET_URL"
Start-NativeExecution -sb {dotnet nuget push $_ --api-key $env:NUGET_KEY --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
Start-NativeExecution -sb {dotnet nuget push $_ --api-key $NuGetKey --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
}
}
if(!$pushedAllArtifacts)
+4 -3
View File
@@ -2,7 +2,8 @@
# Licensed under the MIT License.
param(
[ValidateSet('Bootstrap','Build','Failure','Success')]
[String]$Stage = 'Build'
[String]$Stage = 'Build',
[String]$NugetKey
)
Import-Module $PSScriptRoot/../build.psm1 -Force
@@ -362,10 +363,10 @@ elseif($Stage -eq 'Build')
# 1 - It's a Daily build (already checked, for not a PR)
# 2 - We have the info to publish (NUGET_KEY and NUGET_URL)
# 3 - it's a nupkg file
if($isDailyBuild -and $env:NUGET_KEY -and $env:NUGET_URL -and [system.io.path]::GetExtension($package) -ieq '.nupkg')
if($isDailyBuild -and $NugetKey -and $env:NUGET_URL -and [system.io.path]::GetExtension($package) -ieq '.nupkg')
{
Write-Log "pushing $package to $env:NUGET_URL"
Start-NativeExecution -sb {dotnet nuget push $package --api-key $env:NUGET_KEY --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
Start-NativeExecution -sb {dotnet nuget push $package --api-key $NugetKey --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
}
}
if ($IsLinux)