From bcc95e3308cb744e59b689e629ef214689438f0a Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Fri, 25 Apr 2025 15:31:45 -0500 Subject: [PATCH 1/5] Cherry-pick PR #25437 with conflicts for manual resolution --- .pipelines/PowerShell-Release-Official.yml | 13 +-- .pipelines/PowerShell-vPack-Official.yml | 4 + .pipelines/templates/release-create-msix.yml | 27 +++++++ .pipelines/templates/release-githubtasks.yml | 85 ++++++++++++++------ 4 files changed, 92 insertions(+), 37 deletions(-) diff --git a/.pipelines/PowerShell-Release-Official.yml b/.pipelines/PowerShell-Release-Official.yml index f30b19dfd51..7daa011706a 100644 --- a/.pipelines/PowerShell-Release-Official.yml +++ b/.pipelines/PowerShell-Release-Official.yml @@ -342,17 +342,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 @@ -365,7 +354,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 diff --git a/.pipelines/PowerShell-vPack-Official.yml b/.pipelines/PowerShell-vPack-Official.yml index 8a3679d1210..53d1eaad3c3 100644 --- a/.pipelines/PowerShell-vPack-Official.yml +++ b/.pipelines/PowerShell-vPack-Official.yml @@ -118,7 +118,11 @@ extends: ob_createvpack_verbose: true steps: +<<<<<<< HEAD - template: tools/releaseBuild/azureDevOps/templates/SetVersionVariables.yml@self +======= + - template: .pipelines/templates/SetVersionVariables.yml@self +>>>>>>> ca7038b7c (Fix MSIX artifact upload, vPack template, changelog hashes, git tag command (#25437)) parameters: ReleaseTagVar: $(ReleaseTagVar) CreateJson: yes diff --git a/.pipelines/templates/release-create-msix.yml b/.pipelines/templates/release-create-msix.yml index 3714e623b5e..87813a732b6 100644 --- a/.pipelines/templates/release-create-msix.yml +++ b/.pipelines/templates/release-create-msix.yml @@ -75,6 +75,33 @@ jobs: displayName: Create MsixBundle retryCountOnTaskFailure: 1 +<<<<<<< HEAD +======= + - task: onebranch.pipeline.signing@1 + displayName: Sign MsixBundle + inputs: + command: 'sign' + signing_profile: $(MSIXProfile) + files_to_sign: '**/*.msixbundle' + search_root: '$(BundleDir)' + + - pwsh: | + $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:" + Get-ChildItem -Path $(ob_outputDirectory) | Write-Verbose -Verbose + displayName: Upload msixbundle to Artifacts + +>>>>>>> ca7038b7c (Fix MSIX artifact upload, vPack template, changelog hashes, git tag command (#25437)) - task: AzurePowerShell@5 displayName: Upload msix to blob inputs: diff --git a/.pipelines/templates/release-githubtasks.yml b/.pipelines/templates/release-githubtasks.yml index b0358a1704f..f05c4cde113 100644 --- a/.pipelines/templates/release-githubtasks.yml +++ b/.pipelines/templates/release-githubtasks.yml @@ -26,12 +26,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' @@ -52,7 +49,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 @@ -60,7 +56,6 @@ jobs: - task: PowerShell@2 inputs: targetType: inline - pwsh: true script: | $releaseVersion = '$(ReleaseTag)' -replace '^v','' Write-Verbose -Verbose "Available modules: " @@ -81,6 +76,20 @@ jobs: $clContent = $changelog | Select-Object -Skip ($startLine-1) -First ($endLine - $startLine) | Out-String +<<<<<<< HEAD:.pipelines/templates/release-githubtasks.yml +======= + $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() + +>>>>>>> ca7038b7c (Fix MSIX artifact upload, vPack template, changelog hashes, git tag command (#25437)):.pipelines/templates/release-githubNuget.yml Write-Verbose -Verbose "Selected content: `n$clContent" $releaseNotesFilePath = "$(Pipeline.Workspace)/release-notes.md" @@ -96,11 +105,32 @@ 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 = '' + $tagString = "$(ReleaseTag)" + Write-Verbose -Verbose "Use the following command to push the tag:" + if ($tagString -match '-') { + $middleURL = "preview" + } + elseif ($tagString -match '(\d+\.\d+)') { + $middleURL = $matches[1] + } + $endURL = $tagString -replace '[v\.]','' + $message = "https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/$middleURL.md#$endURL" + Write-Verbose -Verbose "git tag -a $(ReleaseTag) $env:BUILD_SOURCEVERSION -m $message" + displayName: Git Push Tag Command + - task: GitHubRelease@1 inputs: gitHubConnection: GitHubReleasePAT @@ -109,6 +139,7 @@ jobs: assets: '$(Pipeline.Workspace)/GitHubPackages/*' tagSource: 'userSpecifiedTag' tag: '$(ReleaseTag)' + title: "$(ReleaseTag) Release of PowerShell" isDraft: true addChangeLog: false action: 'create' @@ -132,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 2d134b46472ce158f5a07072610a7abac19eade7 Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Mon, 28 Apr 2025 13:44:28 -0500 Subject: [PATCH 2/5] Update PowerShell-vPack-Official.yml --- .pipelines/PowerShell-vPack-Official.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.pipelines/PowerShell-vPack-Official.yml b/.pipelines/PowerShell-vPack-Official.yml index 53d1eaad3c3..36b6505dd04 100644 --- a/.pipelines/PowerShell-vPack-Official.yml +++ b/.pipelines/PowerShell-vPack-Official.yml @@ -118,11 +118,7 @@ extends: ob_createvpack_verbose: true steps: -<<<<<<< HEAD - - template: tools/releaseBuild/azureDevOps/templates/SetVersionVariables.yml@self -======= - template: .pipelines/templates/SetVersionVariables.yml@self ->>>>>>> ca7038b7c (Fix MSIX artifact upload, vPack template, changelog hashes, git tag command (#25437)) parameters: ReleaseTagVar: $(ReleaseTagVar) CreateJson: yes From 14a64649247358384a4fc60affff3ea22d56ba9a Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Mon, 28 Apr 2025 13:45:24 -0500 Subject: [PATCH 3/5] Update release-create-msix.yml --- .pipelines/templates/release-create-msix.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.pipelines/templates/release-create-msix.yml b/.pipelines/templates/release-create-msix.yml index 87813a732b6..ac82fc05def 100644 --- a/.pipelines/templates/release-create-msix.yml +++ b/.pipelines/templates/release-create-msix.yml @@ -75,8 +75,6 @@ jobs: displayName: Create MsixBundle retryCountOnTaskFailure: 1 -<<<<<<< HEAD -======= - task: onebranch.pipeline.signing@1 displayName: Sign MsixBundle inputs: @@ -101,7 +99,6 @@ jobs: Get-ChildItem -Path $(ob_outputDirectory) | Write-Verbose -Verbose displayName: Upload msixbundle to Artifacts ->>>>>>> ca7038b7c (Fix MSIX artifact upload, vPack template, changelog hashes, git tag command (#25437)) - task: AzurePowerShell@5 displayName: Upload msix to blob inputs: From 31c6f795a2d6c8f8ef595ed00d6fe7b6d518f46d Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Mon, 28 Apr 2025 13:47:25 -0500 Subject: [PATCH 4/5] Update release-githubtasks.yml --- .pipelines/templates/release-githubtasks.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.pipelines/templates/release-githubtasks.yml b/.pipelines/templates/release-githubtasks.yml index f05c4cde113..01382156918 100644 --- a/.pipelines/templates/release-githubtasks.yml +++ b/.pipelines/templates/release-githubtasks.yml @@ -1,3 +1,8 @@ +parameters: + - name: skipPublish + default: false + type: boolean + jobs: - job: GithubReleaseDraft displayName: Create GitHub Release Draft @@ -76,8 +81,6 @@ jobs: $clContent = $changelog | Select-Object -Skip ($startLine-1) -First ($endLine - $startLine) | Out-String -<<<<<<< HEAD:.pipelines/templates/release-githubtasks.yml -======= $StringBuilder = [System.Text.StringBuilder]::new($clContent, $clContent.Length + 2kb) $StringBuilder.AppendLine().AppendLine() > $null $StringBuilder.AppendLine("### SHA256 Hashes of the release artifacts").AppendLine() > $null @@ -89,7 +92,6 @@ jobs: $clContent = $StringBuilder.ToString() ->>>>>>> ca7038b7c (Fix MSIX artifact upload, vPack template, changelog hashes, git tag command (#25437)):.pipelines/templates/release-githubNuget.yml Write-Verbose -Verbose "Selected content: `n$clContent" $releaseNotesFilePath = "$(Pipeline.Workspace)/release-notes.md" From 520b49b0c31163242fbe54862ff568e1c79ebf1c Mon Sep 17 00:00:00 2001 From: Justin Chung <124807742+jshigetomi@users.noreply.github.com> Date: Mon, 28 Apr 2025 13:58:33 -0500 Subject: [PATCH 5/5] Fix Github yaml --- .../{release-githubtasks.yml => release-githubNuget.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .pipelines/templates/{release-githubtasks.yml => release-githubNuget.yml} (100%) diff --git a/.pipelines/templates/release-githubtasks.yml b/.pipelines/templates/release-githubNuget.yml similarity index 100% rename from .pipelines/templates/release-githubtasks.yml rename to .pipelines/templates/release-githubNuget.yml