Skip to content

Commit 9ca65f1

Browse files
Add conditional stage to upload the generated nuget package to the UploadPackageToPreReleaseFeed. (#530) (#556)
* Evaluate the AzureFunctionsPreReleaseFeed variable and decide whether the generated nuget package will be uploaded to the AzureFunctionsPreReleaseFeed * Add conditional stage to upload the PowerShell worker nuget package to the AzureFunctionsPreReleaseFeed.
1 parent 9dad04d commit 9ca65f1

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

azure-pipelines.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,31 @@ steps:
5959
Copy-Item -Path $sourcePath -Destination $(Build.ArtifactStagingDirectory) -ErrorAction Stop -Verbose -Force
6060
displayName: 'Copy package to ArtifactStagingDirectory'
6161

62+
- pwsh: |
63+
$uploadPackage = $null
64+
if (-not ([bool]::TryParse($env:UPLOADPACKAGETOPRERELEASEFEED, [ref] $uploadPackage)))
65+
{
66+
throw "UploadPackageToPreReleaseFeed can only be set to True or False. Current value is set to $env:UPLOADPACKAGETOPRERELEASEFEED"
67+
}
68+
Write-Host "##vso[task.setvariable variable=UploadPackage]$uploadPackage"
69+
Write-Host "UploadPackage: $uploadPackage"
70+
displayName: 'Set UploadPackage variable'
71+
6272
- task: NuGetCommand@2
63-
condition: and(ne(variables['Build.Reason'], 'PullRequest'), in(variables['Build.SourceBranch'], 'refs/heads/v3.x/ps7', 'refs/heads/v3.x/ps6', 'refs/heads/v2.x'))
73+
condition: and(ne(variables['Build.Reason'], 'PullRequest'), in(variables['Build.SourceBranch'], 'refs/heads/v3.x/ps7', 'refs/heads/v3.x/ps6', 'refs/heads/v2.x'), eq(variables.UploadPackage, false))
6474
inputs:
6575
command: 'push'
6676
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
6777
nuGetFeedType: 'internal'
6878
publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/c0493cce-bc63-4e11-9fc9-e7c45291f151'
6979
allowPackageConflicts: true
7080
displayName: 'Push NuGet package'
81+
82+
- task: NuGetCommand@2
83+
condition: eq(variables.UploadPackage, true)
84+
inputs:
85+
command: 'push'
86+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
87+
nuGetFeedType: 'internal'
88+
publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df'
89+
allowPackageConflicts: true

0 commit comments

Comments
 (0)