-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Move NuGet publish stage after pushing tag in release pipeline #27316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||||||||||||||||||
| parameters: | ||||||||||||||||||||||
| - name: skipPublish | ||||||||||||||||||||||
| type: boolean | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||
| - job: NuGetPublish | ||||||||||||||||||||||
| displayName: Publish to NuGet | ||||||||||||||||||||||
| condition: succeeded() | ||||||||||||||||||||||
| pool: | ||||||||||||||||||||||
| type: release | ||||||||||||||||||||||
| os: windows | ||||||||||||||||||||||
| templateContext: | ||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||
| - input: pipelineArtifact | ||||||||||||||||||||||
| pipeline: PSPackagesOfficial | ||||||||||||||||||||||
| artifactName: drop_upload_upload_packages | ||||||||||||||||||||||
| variables: | ||||||||||||||||||||||
| - template: ./variables/release-shared.yml@self | ||||||||||||||||||||||
| parameters: | ||||||||||||||||||||||
| VERSION: $[ stageDependencies.setReleaseTagAndChangelog.SetTagAndChangelog.outputs['OutputVersion.Version'] ] | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| steps: | ||||||||||||||||||||||
| - task: PowerShell@2 | ||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||
| targetType: inline | ||||||||||||||||||||||
| script: | | ||||||||||||||||||||||
| Write-Verbose -Verbose "Version: $(Version)" | ||||||||||||||||||||||
| Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose | ||||||||||||||||||||||
| displayName: 'Capture Environment Variables' | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - task: PowerShell@2 | ||||||||||||||||||||||
| inputs: | ||||||||||||||||||||||
| targetType: inline | ||||||||||||||||||||||
| script: | | ||||||||||||||||||||||
| #Exclude all global tool packages. Their names start with 'PowerShell.' | ||||||||||||||||||||||
| $null = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/release" | ||||||||||||||||||||||
| Copy-Item "$(Pipeline.Workspace)/NuGetPackages/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| $releaseVersion = '$(Version)' | ||||||||||||||||||||||
| $globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg" | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if ($releaseVersion -notlike '*-*') { | ||||||||||||||||||||||
| # Copy the global tool package for stable releases | ||||||||||||||||||||||
| Copy-Item $globalToolPath -Destination "$(Pipeline.Workspace)/release" | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Write-Verbose -Verbose "The .nupkgs below will be pushed:" | ||||||||||||||||||||||
| Get-ChildItem "$(Pipeline.Workspace)/release" -recurse | ||||||||||||||||||||||
| displayName: Download and capture nupkgs | ||||||||||||||||||||||
| condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded()) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| - task: NuGetCommand@2 | ||||||||||||||||||||||
| displayName: 'NuGet push' | ||||||||||||||||||||||
| condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded()) | ||||||||||||||||||||||
|
Comment on lines
+50
to
+54
|
||||||||||||||||||||||
| condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded()) | |
| - task: NuGetCommand@2 | |
| displayName: 'NuGet push' | |
| condition: and(ne('${{ parameters.skipPublish }}', 'true'), succeeded()) | |
| condition: and(succeeded(), not(${{ parameters.skipPublish }})) | |
| - task: NuGetCommand@2 | |
| displayName: 'NuGet push' | |
| condition: and(succeeded(), not(${{ parameters.skipPublish }})) |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -159,21 +159,21 @@ stages: | |||||||
| Update and merge the changelog for the release. | ||||||||
| This step is required for creating GitHub draft release. | ||||||||
|
|
||||||||
| - stage: PublishGitHubReleaseAndNuget | ||||||||
| displayName: Publish GitHub and Nuget Release | ||||||||
| - stage: PublishGitHubRelease | ||||||||
| displayName: Publish GitHub | ||||||||
| dependsOn: | ||||||||
| - setReleaseTagAndChangelog | ||||||||
| - UpdateChangeLog | ||||||||
| variables: | ||||||||
| ob_release_environment: ${{ parameters.releaseEnvironment }} | ||||||||
| jobs: | ||||||||
| - template: /.pipelines/templates/release-githubNuget.yml@self | ||||||||
| - template: /.pipelines/templates/release-github.yml@self | ||||||||
| parameters: | ||||||||
| skipPublish: ${{ parameters.SkipPublish }} | ||||||||
|
|
||||||||
| - stage: PushGitTagAndMakeDraftPublic | ||||||||
| displayName: Push Git Tag and Make Draft Public | ||||||||
| dependsOn: PublishGitHubReleaseAndNuget | ||||||||
| dependsOn: PublishGitHubRelease | ||||||||
| jobs: | ||||||||
| - template: /.pipelines/templates/approvalJob.yml@self | ||||||||
| parameters: | ||||||||
|
|
@@ -190,6 +190,18 @@ stages: | |||||||
| instructions: | | ||||||||
| Make the GitHub Release Draft Public | ||||||||
|
|
||||||||
| - stage: PublishNugetRelease | ||||||||
| displayName: Publish Nuget Release | ||||||||
| dependsOn: | ||||||||
|
||||||||
| dependsOn: | |
| dependsOn: | |
| - setReleaseTagAndChangelog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think copilot is right
Copilot
AI
Apr 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PublishNugetRelease references a template path that doesn't exist in this PR: the repo adds .pipelines/templates/release-Nuget.yml, but the stage includes /.pipelines/templates/release-nuget.yml@self. On case-sensitive agents/template resolution this will fail to load. Rename the file or update the template reference so the casing/name matches exactly (and keep it consistent with other release-*.yml templates).
| - template: /.pipelines/templates/release-nuget.yml@self | |
| - template: /.pipelines/templates/release-Nuget.yml@self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think copilot is right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output reference casing here doesn't match the producing job name.
release-SetTagAndChangelog.ymldefines the job assetTagAndChangelog, but this template usesSetTagAndChangeloginstageDependencies.setReleaseTagAndChangelog.SetTagAndChangelog.outputs[...]. Update the reference to use the correct job name to ensure theOutputVersion.Versionvalue resolves reliably.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think copilot is right