|
| 1 | +parameters: |
| 2 | + stageName: '' |
| 3 | + environmentName: '' |
| 4 | + feedCredential: '' |
| 5 | + feedUrl: '' |
| 6 | + |
| 7 | +stages: |
| 8 | +- stage: ${{ parameters.stageName }} |
| 9 | + displayName: Release Microsoft.PowerShell.TextUtility to '${{ parameters.stageName }}' |
| 10 | + condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release/')) |
| 11 | + |
| 12 | + jobs: |
| 13 | + - deployment: Publish_${{ parameters.stageName }} |
| 14 | + displayName: Release to Feed |
| 15 | + pool: |
| 16 | + vmImage: windows-latest |
| 17 | + |
| 18 | + environment: ${{ parameters.environmentName }} |
| 19 | + strategy: |
| 20 | + runOnce: |
| 21 | + deploy: |
| 22 | + steps: |
| 23 | + - download: current |
| 24 | + artifact: nuget |
| 25 | + |
| 26 | + - powershell: | |
| 27 | + Get-ChildItem -Recurse "$(Pipeline.Workspace)/nuget" |
| 28 | + displayName: Capture downloaded artifact |
| 29 | +
|
| 30 | + - powershell: | |
| 31 | + Copy-Item "$(Pipeline.Workspace)/nuget/Microsoft.PowerShell.TextUtility.*.nupkg" -Destination "$(Build.ArtifactStagingDirectory)" -Force |
| 32 | + $package = (Get-ChildItem "$(Build.ArtifactStagingDirectory)/Microsoft.PowerShell.TextUtility.*.nupkg").Fullname |
| 33 | + $vstsCommandString = "vso[task.setvariable variable=NugetPkgPath]${package}" |
| 34 | + Write-Host "sending " + $vstsCommandString |
| 35 | + Write-Host "##$vstsCommandString" |
| 36 | + displayName: 'Copy and Capture NuGet package' |
| 37 | +
|
| 38 | + - task: NuGetAuthenticate@0 |
| 39 | + condition: ne('${{ parameters.feedUrl }}', '') |
| 40 | + |
| 41 | + - powershell: | |
| 42 | + nuget push -ApiKey AzureArtifacts -source '${{ parameters.feedUrl }}' '$(NugetPkgPath)' |
| 43 | + displayName: Push to internal feed |
| 44 | + condition: ne('${{ parameters.feedUrl }}', '') |
| 45 | +
|
| 46 | + - task: NuGetCommand@2 |
| 47 | + displayName: 'NuGet push' |
| 48 | + inputs: |
| 49 | + command: push |
| 50 | + packagesToPush: '$(NugetPkgPath)' |
| 51 | + nuGetFeedType: external |
| 52 | + publishFeedCredentials: ${{ parameters.feedCredential }} |
| 53 | + condition: eq('${{ parameters.feedUrl }}', '') |
0 commit comments