From d4fd860f450719ee207cd6060fd1c71ccc3b23c0 Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Wed, 23 Apr 2025 15:40:50 -0500 Subject: [PATCH 01/10] Fix upload msix bundle as an artifact --- .pipelines/templates/release-create-msix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/templates/release-create-msix.yml b/.pipelines/templates/release-create-msix.yml index 751ce1ec5e2..2e6bf5793d9 100644 --- a/.pipelines/templates/release-create-msix.yml +++ b/.pipelines/templates/release-create-msix.yml @@ -87,7 +87,7 @@ jobs: $signedBundle = Get-ChildItem -Path $(BundleDir) -Filter "*.msixbundle" -File Write-Verbose -Verbose "Signed bundle: $signedBundle" - Copy-Item -Path $signedBundle -Destination $(ob_outputDirectory) -Verbose + Copy-Item -Path $signedBundle.FullName -Destination "$(ob_outputDirectory)\$($signedBundle.Name)" -Verbose Write-Verbose -Verbose "Uploaded Bundle:" Get-ChildItem -Path $(ob_outputDirectory) | Write-Verbose -Verbose From 4c0a56f6371509c6bb41106832ec178388c3af7e Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:19:31 -0500 Subject: [PATCH 02/10] Create onebranch directory --- .pipelines/templates/release-create-msix.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.pipelines/templates/release-create-msix.yml b/.pipelines/templates/release-create-msix.yml index 2e6bf5793d9..ac82fc05def 100644 --- a/.pipelines/templates/release-create-msix.yml +++ b/.pipelines/templates/release-create-msix.yml @@ -87,6 +87,12 @@ jobs: $signedBundle = Get-ChildItem -Path $(BundleDir) -Filter "*.msixbundle" -File Write-Verbose -Verbose "Signed bundle: $signedBundle" + # Ensure the destination directory exists + if (-not (Test-Path -Path "$(ob_outputDirectory)")) { + Write-Verbose -Verbose "Creating destination directory: $(ob_outputDirectory)" + New-Item -Path "$(ob_outputDirectory)" -ItemType Directory -Force | Out-Null + } + Copy-Item -Path $signedBundle.FullName -Destination "$(ob_outputDirectory)\$($signedBundle.Name)" -Verbose Write-Verbose -Verbose "Uploaded Bundle:" From 1e71be8279dad31895a29fd3fb277cc44a0f44f9 Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:15:48 -0500 Subject: [PATCH 03/10] Use absolute path --- .pipelines/PowerShell-vPack-Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/PowerShell-vPack-Official.yml b/.pipelines/PowerShell-vPack-Official.yml index 9745a98e7ba..b4ba57c5d2d 100644 --- a/.pipelines/PowerShell-vPack-Official.yml +++ b/.pipelines/PowerShell-vPack-Official.yml @@ -118,7 +118,7 @@ extends: ob_createvpack_verbose: true steps: - - template: ./templates/SetVersionVariables.yml + - template: ./pipelines/templates/SetVersionVariables.yml@self parameters: ReleaseTagVar: $(ReleaseTagVar) CreateJson: yes From 76a422abbb84e49e16968099aac0e987c3f106b8 Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:16:50 -0500 Subject: [PATCH 04/10] Fix syntax --- .pipelines/PowerShell-vPack-Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/PowerShell-vPack-Official.yml b/.pipelines/PowerShell-vPack-Official.yml index b4ba57c5d2d..499483e4f60 100644 --- a/.pipelines/PowerShell-vPack-Official.yml +++ b/.pipelines/PowerShell-vPack-Official.yml @@ -118,7 +118,7 @@ extends: ob_createvpack_verbose: true steps: - - template: ./pipelines/templates/SetVersionVariables.yml@self + - template: pipelines/templates/SetVersionVariables.yml@self parameters: ReleaseTagVar: $(ReleaseTagVar) CreateJson: yes From d56577b1115bb543f4518a66397e37e51652bb82 Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:17:44 -0500 Subject: [PATCH 05/10] Add the dot --- .pipelines/PowerShell-vPack-Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/PowerShell-vPack-Official.yml b/.pipelines/PowerShell-vPack-Official.yml index 499483e4f60..36b6505dd04 100644 --- a/.pipelines/PowerShell-vPack-Official.yml +++ b/.pipelines/PowerShell-vPack-Official.yml @@ -118,7 +118,7 @@ extends: ob_createvpack_verbose: true steps: - - template: pipelines/templates/SetVersionVariables.yml@self + - template: .pipelines/templates/SetVersionVariables.yml@self parameters: ReleaseTagVar: $(ReleaseTagVar) CreateJson: yes From 1e5db48e5774e3923a90f7d8594613cf78a1257e Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Fri, 25 Apr 2025 10:52:54 -0500 Subject: [PATCH 06/10] Add hashes to CL and draft title --- .pipelines/templates/release-githubNuget.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.pipelines/templates/release-githubNuget.yml b/.pipelines/templates/release-githubNuget.yml index bf5a3dd5248..d994f51a9d7 100644 --- a/.pipelines/templates/release-githubNuget.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -84,6 +84,17 @@ jobs: $endLine = $headingStartLines[1] - 1 $clContent = $changelog | Select-Object -Skip ($startLine-1) -First ($endLine - $startLine) | Out-String + + $StringBuilder = [System.Text.StringBuilder]::new($clContent, $clContent.Length + 2kb) + $StringBuilder.AppendLine().AppendLine() > $null + $StringBuilder.AppendLine("### SHA256 Hashes of the release artifacts").AppendLine() > $null + Get-ChildItem -Path "$(Pipeline.Workspace)/GitHubPackages/" -File | ForEach-Object { + $PackageName = $_.Name + $SHA256 = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash + $StringBuilder.AppendLine("- $PackageName").AppendLine(" - $SHA256") > $null + } + + $clContent = $StringBuilder.ToString() Write-Verbose -Verbose "Selected content: `n$clContent" @@ -113,6 +124,7 @@ jobs: assets: '$(Pipeline.Workspace)/GitHubPackages/*' tagSource: 'userSpecifiedTag' tag: '$(ReleaseTag)' + title: "$(ReleaseTag) Release of PowerShell" isDraft: true addChangeLog: false action: 'create' From 121e485786750288a49d8f81d73e0602aae2ae08 Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Fri, 25 Apr 2025 12:42:12 -0500 Subject: [PATCH 07/10] Update .NET CLI command and remove docker release --- .pipelines/PowerShell-Release-Official.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.pipelines/PowerShell-Release-Official.yml b/.pipelines/PowerShell-Release-Official.yml index f9a385bd69e..7e8c0c84ade 100644 --- a/.pipelines/PowerShell-Release-Official.yml +++ b/.pipelines/PowerShell-Release-Official.yml @@ -333,17 +333,6 @@ extends: instructions: | Run PowerShell-Release-Official-Azure.yml pipeline to publish to PMC - - stage: ReleaseDocker - dependsOn: PushGitTagAndMakeDraftPublic - displayName: 'Docker Release' - jobs: - - template: /.pipelines/templates/approvalJob.yml@self - parameters: - displayName: Start Docker Release - jobName: StartDockerRelease - instructions: | - Kickoff docker release - - stage: UpdateDotnetDocker dependsOn: PushGitTagAndMakeDraftPublic displayName: Update DotNet SDK Docker images @@ -356,7 +345,7 @@ extends: Create PR for updating dotnet-docker images to use latest PowerShell version. 1. Fork and clone https://github.com/dotnet/dotnet-docker.git 2. git checkout upstream/nightly -b updatePS - 3. dotnet run --project .\eng\update-dependencies\ -- --product-version powershell= --compute-shas + 3. dotnet run --project .\eng\update-dependencies\ specific --product-version powershell= --compute-shas 4. create PR targeting nightly branch - stage: UpdateWinGet From 3f1fb4f92f972a81fc81f7d6662a8f5b9f6ce434 Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:09:09 -0500 Subject: [PATCH 08/10] Remove pwsh install, use powershell@ task, generate git command --- .pipelines/templates/release-githubNuget.yml | 69 +++++++++++++------- 1 file changed, 44 insertions(+), 25 deletions(-) diff --git a/.pipelines/templates/release-githubNuget.yml b/.pipelines/templates/release-githubNuget.yml index d994f51a9d7..82e961e62dc 100644 --- a/.pipelines/templates/release-githubNuget.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -30,12 +30,9 @@ jobs: Get-ChildItem Env: | Out-String -Stream | Write-Verbose -Verbose displayName: 'Capture Environment Variables' - - template: release-install-pwsh.yml - - task: PowerShell@2 inputs: targetType: inline - pwsh: true script: | $Path = "$(Pipeline.Workspace)/GitHubPackages" $OutputPath = Join-Path $Path 'hashes.sha256' @@ -56,7 +53,6 @@ jobs: - task: PowerShell@2 inputs: targetType: inline - pwsh: true script: | Get-ChildItem $(Pipeline.Workspace) -recurse | Select-Object -ExpandProperty FullName displayName: List all files in the workspace @@ -64,7 +60,6 @@ jobs: - task: PowerShell@2 inputs: targetType: inline - pwsh: true script: | $releaseVersion = '$(ReleaseTag)' -replace '^v','' Write-Verbose -Verbose "Available modules: " @@ -111,11 +106,31 @@ jobs: } displayName: Set variables for GitHub release task - - pwsh: | - Write-Host "ReleaseNotes content:" - Get-Content "$(Pipeline.Workspace)/release-notes.md" -Raw | Out-String -width 9999 | Write-Host + - task: PowerShell@2 + inputs: + targetType: inline + script: | + Write-Host "ReleaseNotes content:" + Get-Content "$(Pipeline.Workspace)/release-notes.md" -Raw | Out-String -width 9999 | Write-Host displayName: Verify Release Notes + - task: PowerShell@2 + inputs: + targetType: inline + script: | + $middleURL = '' + Write-Verbose -Verbose "Use the following command to push the tag:" + if ($(ReleaseTag) -match '-') { + $middleURL = "preview" + } + elseif ($(ReleaseTag) -match '(\d+\.\d+)') { + $middleURL = $matches[1] + } + $endURL = $(ReleaseTag) -replace '[v\.]','' + $message = "https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/$middleURL.md#$endURL" + Write-Verbose -Verbose "git tag -a $(ReleaseTag) $(BUILD_SOURCEVERSION) -m '$(ReleaseTag)'" + displayName: Git Push Tag Command + - task: GitHubRelease@1 inputs: gitHubConnection: GitHubReleasePAT @@ -148,28 +163,32 @@ jobs: VERSION: $[ stageDependencies.setReleaseTagAndChangelog.SetTagAndChangelog.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 + - 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' - - 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 + - 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" + $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" - } + 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 + 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()) From b3024095cef7e50db98354a80e5ee42fe40e486e Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Fri, 25 Apr 2025 13:27:14 -0500 Subject: [PATCH 09/10] Fix string resolution --- .pipelines/templates/release-githubNuget.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.pipelines/templates/release-githubNuget.yml b/.pipelines/templates/release-githubNuget.yml index 82e961e62dc..0f27cbb76f0 100644 --- a/.pipelines/templates/release-githubNuget.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -119,14 +119,15 @@ jobs: targetType: inline script: | $middleURL = '' + $tagString = "$(ReleaseTag)" Write-Verbose -Verbose "Use the following command to push the tag:" - if ($(ReleaseTag) -match '-') { + if ($tagString -match '-') { $middleURL = "preview" } - elseif ($(ReleaseTag) -match '(\d+\.\d+)') { + elseif ($tagString -match '(\d+\.\d+)') { $middleURL = $matches[1] } - $endURL = $(ReleaseTag) -replace '[v\.]','' + $endURL = $tagString -replace '[v\.]','' $message = "https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/$middleURL.md#$endURL" Write-Verbose -Verbose "git tag -a $(ReleaseTag) $(BUILD_SOURCEVERSION) -m '$(ReleaseTag)'" displayName: Git Push Tag Command From 42b4487670ada6f13e28ed799d5e3f3fe60c73fd Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Fri, 25 Apr 2025 14:19:07 -0500 Subject: [PATCH 10/10] use message --- .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 0f27cbb76f0..4c4bcd7e86e 100644 --- a/.pipelines/templates/release-githubNuget.yml +++ b/.pipelines/templates/release-githubNuget.yml @@ -129,7 +129,7 @@ jobs: } $endURL = $tagString -replace '[v\.]','' $message = "https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/$middleURL.md#$endURL" - Write-Verbose -Verbose "git tag -a $(ReleaseTag) $(BUILD_SOURCEVERSION) -m '$(ReleaseTag)'" + Write-Verbose -Verbose "git tag -a $(ReleaseTag) $env:BUILD_SOURCEVERSION -m $message" displayName: Git Push Tag Command - task: GitHubRelease@1