Skip to content

Commit 905f353

Browse files
Add conditional stage to upload the generated nuget package to the UploadPackageToPreReleaseFeed. (#530)
* 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 9fd52cd commit 905f353

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
@@ -58,12 +58,31 @@ steps:
5858
Copy-Item -Path $sourcePath -Destination $(Build.ArtifactStagingDirectory) -ErrorAction Stop -Verbose -Force
5959
displayName: 'Copy package to ArtifactStagingDirectory'
6060

61+
- pwsh: |
62+
$uploadPackage = $null
63+
if (-not ([bool]::TryParse($env:UPLOADPACKAGETOPRERELEASEFEED, [ref] $uploadPackage)))
64+
{
65+
throw "UploadPackageToPreReleaseFeed can only be set to True or False. Current value is set to $env:UPLOADPACKAGETOPRERELEASEFEED"
66+
}
67+
Write-Host "##vso[task.setvariable variable=UploadPackage]$uploadPackage"
68+
Write-Host "UploadPackage: $uploadPackage"
69+
displayName: 'Set UploadPackage variable'
70+
6171
- task: NuGetCommand@2
62-
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'))
72+
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))
6373
inputs:
6474
command: 'push'
6575
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
6676
nuGetFeedType: 'internal'
6777
publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/c0493cce-bc63-4e11-9fc9-e7c45291f151'
6878
allowPackageConflicts: true
6979
displayName: 'Push NuGet package'
80+
81+
- task: NuGetCommand@2
82+
condition: eq(variables.UploadPackage, true)
83+
inputs:
84+
command: 'push'
85+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
86+
nuGetFeedType: 'internal'
87+
publishVstsFeed: 'e6a70c92-4128-439f-8012-382fe78d6396/f37f760c-aebd-443e-9714-ce725cd427df'
88+
allowPackageConflicts: true

0 commit comments

Comments
 (0)