From 345a13ad322ebf95f885e92591e3e69b9c38d923 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Fri, 11 Apr 2025 12:51:41 -0500 Subject: [PATCH 1/7] Combined github and nuget releases --- .pipelines/PowerShell-Release-Official.yml | 33 ++++------ ...ithubtasks.yml => release-githubNuget.yml} | 60 +++++++++++++++++++ .../templates/release-publish-nuget.yml | 58 ------------------ 3 files changed, 71 insertions(+), 80 deletions(-) rename .pipelines/templates/{release-githubtasks.yml => release-githubNuget.yml} (60%) delete mode 100644 .pipelines/templates/release-publish-nuget.yml diff --git a/.pipelines/PowerShell-Release-Official.yml b/.pipelines/PowerShell-Release-Official.yml index bb83c98ae81..35f1fa1f3aa 100644 --- a/.pipelines/PowerShell-Release-Official.yml +++ b/.pipelines/PowerShell-Release-Official.yml @@ -17,8 +17,8 @@ parameters: # parameters are shown up in ADO UI in a build queue time displayName: Skip Signing type: string default: 'NO' - - name: SkipPMCPublish - displayName: Skip PMC Publish + - name: SkipPublish + displayName: Skip Publishing to GitHub and Nuget type: boolean default: false - name: SkipPSInfraInstallers @@ -83,7 +83,7 @@ resources: - releases/* extends: - template: v2/OneBranch.Official.CrossPlat.yml@templates + template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates parameters: release: category: NonAzure @@ -280,16 +280,18 @@ extends: Update and merge the changelog for the release. This step is required for creating GitHub draft release. - - stage: PublishGitHubRelease - displayName: Publish GitHub Release + - stage: PublishGitHubReleaseAndNuget + displayName: Publish GitHub and Nuget Release dependsOn: - setReleaseTagAndUploadTools - UpdateChangeLog variables: - ob_release_environment: Production + ob_release_environment: Test jobs: - - template: /.pipelines/templates/release-githubtasks.yml@self - + - template: /.pipelines/templates/release-githubNuget.yml@self + parameters: + SkipPublish: ${{ parameters.SkipPublish }} + - stage: PushGitTagAndMakeDraftPublic displayName: Push Git Tag and Make Draft Public dependsOn: PublishGitHubRelease @@ -317,19 +319,7 @@ extends: jobs: - template: /.pipelines/templates/release-MakeBlobPublic.yml@self parameters: - SkipPSInfraInstallers: ${{ parameters.SkipPSInfraInstallers }} - - - stage: PublishNuGet - displayName: Publish NuGet - dependsOn: - - setReleaseTagAndUploadTools - - PushGitTagAndMakeDraftPublic - variables: - ob_release_environment: Production - jobs: - - template: /.pipelines/templates/release-publish-nuget.yml@self - parameters: - skipPublish: true + SkipPSInfraInstallers: ${{ parameters.SkipPSInfraInstallers }} - stage: PublishPMC displayName: Publish PMC @@ -423,7 +413,6 @@ extends: - stage: ChangesToMaster displayName: Ensure changes are in GH master dependsOn: - - PublishNuGet - PublishPMC jobs: - template: /.pipelines/templates/approvalJob.yml@self diff --git a/.pipelines/templates/release-githubtasks.yml b/.pipelines/templates/release-githubNuget.yml similarity index 60% rename from .pipelines/templates/release-githubtasks.yml rename to .pipelines/templates/release-githubNuget.yml index acdb45e18fb..f0f8bb328ae 100644 --- a/.pipelines/templates/release-githubtasks.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -1,3 +1,8 @@ +parameters: + - name: skipPublish + default: false + type: boolean + jobs: - job: GithubReleaseDraft displayName: Create GitHub Release Draft @@ -58,6 +63,7 @@ jobs: displayName: List all files in the workspace - task: PowerShell@2 + condition: and(ne('${{ parameters.skipPublish }}', 'false'), succeeded()) inputs: targetType: inline pwsh: true @@ -86,3 +92,57 @@ jobs: Publish-ReleaseDraft -Tag '$(ReleaseTag)' -Name '$(ReleaseTag) Release of PowerShell' -Description $clContent -User PowerShell -Repository PowerShell -PackageFolder "$(Pipeline.Workspace)/GitHubPackages" -Token $(GitHubReleasePat) displayName: Publish Release Draft + +- job: NuGetPublish + displayName: Publish to NuGet + condition: succeeded() + pool: + type: release + os: windows + templateContext: + inputs: + - input: pipelineArtifact + artifactName: drop_setReleaseTagAndUploadTools_SetTagAndTools + - input: pipelineArtifact + pipeline: PSPackagesOfficial + artifactName: drop_upload_upload_packages + variables: + - template: ./variable/release-shared.yml@self + parameters: + VERSION: $[ stageDependencies.setReleaseTagAndUploadTools.SetTagAndTools.outputs['OutputVersion.Version'] ] + + steps: + - template: release-install-pwsh.yml + + - pwsh: | + Write-Verbose -Verbose "Version: $(Version)" + Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose + displayName: 'Capture Environment Variables' + + - pwsh: | + #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 }}', 'false'), succeeded()) + + - task: NuGetCommand@2 + displayName: 'NuGet push' + condition: and(ne('${{ parameters.skipPublish }}', 'false'), succeeded()) + inputs: + command: push + packagesToPush: '$(Pipeline.Workspace)/release/*.nupkg' + nuGetFeedType: external + publishFeedCredentials: PowerShellNuGetOrgPush + \ No newline at end of file diff --git a/.pipelines/templates/release-publish-nuget.yml b/.pipelines/templates/release-publish-nuget.yml deleted file mode 100644 index 98249844d4c..00000000000 --- a/.pipelines/templates/release-publish-nuget.yml +++ /dev/null @@ -1,58 +0,0 @@ -parameters: - - name: skipPublish - default: false - type: boolean - -jobs: -- job: NuGetPublish - displayName: Publish to NuGet - condition: succeeded() - pool: - type: release - os: windows - templateContext: - inputs: - - input: pipelineArtifact - artifactName: drop_setReleaseTagAndUploadTools_SetTagAndTools - - input: pipelineArtifact - pipeline: PSPackagesOfficial - artifactName: drop_upload_upload_packages - variables: - - template: ./variable/release-shared.yml@self - parameters: - VERSION: $[ stageDependencies.setReleaseTagAndUploadTools.SetTagAndTools.outputs['OutputVersion.Version'] ] - - steps: - - template: release-install-pwsh.yml - - - pwsh: | - Write-Verbose -Verbose "Version: $(Version)" - Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose - displayName: 'Capture Environment Variables' - - - pwsh: | - #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 }}', 'false'), succeeded()) - - - task: NuGetCommand@2 - displayName: 'NuGet push' - condition: and(ne('${{ parameters.skipPublish }}', 'false'), succeeded()) - inputs: - command: push - packagesToPush: '$(Pipeline.Workspace)/release/*.nupkg' - nuGetFeedType: external - publishFeedCredentials: PowerShellNuGetOrgPush From 1158bf1ad9e2c726c8eabfc2809966d13c02af06 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Fri, 11 Apr 2025 12:54:28 -0500 Subject: [PATCH 2/7] Change name for stage dependency --- .pipelines/PowerShell-Release-Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/PowerShell-Release-Official.yml b/.pipelines/PowerShell-Release-Official.yml index 35f1fa1f3aa..c7f4b349eb2 100644 --- a/.pipelines/PowerShell-Release-Official.yml +++ b/.pipelines/PowerShell-Release-Official.yml @@ -294,7 +294,7 @@ extends: - stage: PushGitTagAndMakeDraftPublic displayName: Push Git Tag and Make Draft Public - dependsOn: PublishGitHubRelease + dependsOn: PublishGitHubReleaseAndNuget jobs: - template: /.pipelines/templates/approvalJob.yml@self parameters: From 85b170f1380e6bd57bcabd9e059ed577678fe412 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Fri, 11 Apr 2025 13:35:06 -0500 Subject: [PATCH 3/7] Remove SNAP --- .pipelines/PowerShell-Release-Official.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.pipelines/PowerShell-Release-Official.yml b/.pipelines/PowerShell-Release-Official.yml index c7f4b349eb2..a06daccccec 100644 --- a/.pipelines/PowerShell-Release-Official.yml +++ b/.pipelines/PowerShell-Release-Official.yml @@ -422,17 +422,6 @@ extends: instructions: | Make sure that changes README.md and metadata.json are merged into master on GitHub. - - stage: ReleaseSnap - displayName: Release Snap - dependsOn: ChangesToMaster - jobs: - - template: /.pipelines/templates/approvalJob.yml@self - parameters: - displayName: Publish Snap - jobName: PublishSnapJob - instructions: | - Publish Snap - - stage: ReleaseToMU displayName: Release to MU dependsOn: PushGitTagAndMakeDraftPublic # This only needs the blob to be available @@ -448,7 +437,6 @@ extends: dependsOn: - ReleaseToMU - ReleaseSymbols - - ReleaseSnap jobs: - template: /.pipelines/templates/approvalJob.yml@self parameters: From 8a4e48543ff8fcb92752341f2e6f274d75422764 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Fri, 11 Apr 2025 13:36:55 -0500 Subject: [PATCH 4/7] Switch back to Official --- .pipelines/PowerShell-Release-Official.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pipelines/PowerShell-Release-Official.yml b/.pipelines/PowerShell-Release-Official.yml index a06daccccec..3abe29b5b76 100644 --- a/.pipelines/PowerShell-Release-Official.yml +++ b/.pipelines/PowerShell-Release-Official.yml @@ -83,7 +83,7 @@ resources: - releases/* extends: - template: v2/OneBranch.NonOfficial.CrossPlat.yml@templates + template: v2/OneBranch.Official.CrossPlat.yml@templates parameters: release: category: NonAzure @@ -286,7 +286,7 @@ extends: - setReleaseTagAndUploadTools - UpdateChangeLog variables: - ob_release_environment: Test + ob_release_environment: Production jobs: - template: /.pipelines/templates/release-githubNuget.yml@self parameters: From 821c4182677900a4726ae5a1fe32bfa13397d129 Mon Sep 17 00:00:00 2001 From: Justin Chung Date: Fri, 11 Apr 2025 13:44:24 -0500 Subject: [PATCH 5/7] Fix parameters --- .pipelines/PowerShell-Release-Official.yml | 2 +- .pipelines/templates/release-githubNuget.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.pipelines/PowerShell-Release-Official.yml b/.pipelines/PowerShell-Release-Official.yml index 3abe29b5b76..3830dd16407 100644 --- a/.pipelines/PowerShell-Release-Official.yml +++ b/.pipelines/PowerShell-Release-Official.yml @@ -290,7 +290,7 @@ extends: jobs: - template: /.pipelines/templates/release-githubNuget.yml@self parameters: - SkipPublish: ${{ parameters.SkipPublish }} + skipPublish: ${{ parameters.SkipPublish }} - stage: PushGitTagAndMakeDraftPublic displayName: Push Git Tag and Make Draft Public diff --git a/.pipelines/templates/release-githubNuget.yml b/.pipelines/templates/release-githubNuget.yml index f0f8bb328ae..bf652db4e3d 100644 --- a/.pipelines/templates/release-githubNuget.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -1,6 +1,5 @@ parameters: - name: skipPublish - default: false type: boolean jobs: From 4e591ad231a37f2a7ff9309a432779b4d33a2314 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 11 Apr 2025 11:46:55 -0700 Subject: [PATCH 6/7] Update .pipelines/templates/release-githubNuget.yml --- .pipelines/templates/release-githubNuget.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pipelines/templates/release-githubNuget.yml b/.pipelines/templates/release-githubNuget.yml index bf652db4e3d..980e8217e06 100644 --- a/.pipelines/templates/release-githubNuget.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -143,5 +143,4 @@ jobs: command: push packagesToPush: '$(Pipeline.Workspace)/release/*.nupkg' nuGetFeedType: external - publishFeedCredentials: PowerShellNuGetOrgPush - \ No newline at end of file + publishFeedCredentials: PowerShellNuGetOrgPush \ No newline at end of file From 34b112c75a09cd3661902d929a8d9d39494f4e48 Mon Sep 17 00:00:00 2001 From: Travis Plunk Date: Fri, 11 Apr 2025 11:48:09 -0700 Subject: [PATCH 7/7] Update .pipelines/templates/release-githubNuget.yml --- .pipelines/templates/release-githubNuget.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/templates/release-githubNuget.yml b/.pipelines/templates/release-githubNuget.yml index 980e8217e06..330eb2dee1c 100644 --- a/.pipelines/templates/release-githubNuget.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -143,4 +143,4 @@ jobs: command: push packagesToPush: '$(Pipeline.Workspace)/release/*.nupkg' nuGetFeedType: external - publishFeedCredentials: PowerShellNuGetOrgPush \ No newline at end of file + publishFeedCredentials: PowerShellNuGetOrgPush