8000 Fix MSIX artifact upload, vPack template, changelog hashes, git tag c… · PowerShell/PowerShell@ca7038b · GitHub
[go: up one dir, main page]

Skip to content

Commit ca7038b

Browse files
authored
Fix MSIX artifact upload, vPack template, changelog hashes, git tag command (#25437)
1 parent 658a8e4 commit ca7038b

File tree

4 files changed

+66
-39
lines changed

4 files changed

+66
-39
lines changed

.pipelines/PowerShell-Release-Official.yml

+1-12
Original file line numberDiff line numberDiff line change
@@ -333,17 +333,6 @@ extends:
333333
instructions: |
334334
Run PowerShell-Release-Official-Azure.yml pipeline to publish to PMC
335335
336-
- stage: ReleaseDocker
337-
dependsOn: PushGitTagAndMakeDraftPublic
338-
displayName: 'Docker Release'
339-
jobs:
340-
- template: /.pipelines/templates/approvalJob.yml@self
341-
parameters:
342-
displayName: Start Docker Release
343-
jobName: StartDockerRelease
344-
instructions: |
345-
Kickoff docker release
346-
347336
- stage: UpdateDotnetDocker
348337
dependsOn: PushGitTagAndMakeDraftPublic
349338
displayName: Update DotNet SDK Docker images
@@ -356,7 +345,7 @@ extends:
356345
Create PR for updating dotnet-docker images to use latest PowerShell version.
357346
1. Fork and clone https://github.com/dotnet/dotnet-docker.git
358347
2. git checkout upstream/nightly -b updatePS
359-
3. dotnet run --project .\eng\update-dependencies\ -- <dotnetversion> --product-version powershell=<powershellversion> --compute-shas
348+
3. dotnet run --project .\eng\update-dependencies\ specific <dotnetversion> --product-version powershell=<powershellversion> --compute-shas
360349
4. create PR targeting nightly branch
361350
362351
- stage: UpdateWinGet

.pipelines/PowerShell-vPack-Official.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ extends:
118118
ob_createvpack_verbose: true
119119

120120
steps:
121-
- template: ./templates/SetVersionVariables.yml
121+
- template: .pipelines/templates/SetVersionVariables.yml@self
122122
parameters:
123123
ReleaseTagVar: $(ReleaseTagVar)
124124
CreateJson: yes

.pipelines/templates/release-create-msix.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ jobs:
8787
$signedBundle = Get-ChildItem -Path $(BundleDir) -Filter "*.msixbundle" -File
8888
Write-Verbose -Verbose "Signed bundle: $signedBundle"
8989
90-
Copy-Item -Path $signedBundle -Destination $(ob_outputDirectory) -Verbose
90+
# Ensure the destination directory exists
91+
if (-not (Test-Path -Path "$(ob_outputDirectory)")) {
92+
Write-Verbose -Verbose "Creating destination directory: $(ob_outputDirectory)"
93+
New-Item -Path "$(ob_outputDirectory)" -ItemType Directory -Force | Out-Null
94+
}
95+
96+
Copy-Item -Path $signedBundle.FullName -Destination "$(ob_outputDirectory)\$($signedBundle.Name)" -Verbose
9197
9298
Write-Verbose -Verbose "Uploaded Bundle:"
9399
Get-ChildItem -Path $(ob_outputDirectory) | Write-Verbose -Verbose

.pipelines/templates/release-githubNuget.yml

+57-25
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ jobs:
3030
Get-ChildItem Env: | Out-String -Stream | Write-Verbose -Verbose
3131
displayName: 'Capture Environment Variables'
3232

33-
- template: release-install-pwsh.yml
34-
3533
- task: PowerShell@2
3634
inputs:
3735
targetType: inline
38-
pwsh: true
3936
script: |
4037
$Path = "$(Pipeline.Workspace)/GitHubPackages"
4138
$OutputPath = Join-Path $Path 'hashes.sha256'
@@ -56,15 +53,13 @@ jobs:
5653
- task: PowerShell@2
5754
inputs:
5855
targetType: inline
59-
pwsh: true
6056
script: |
6157
Get-ChildItem $(Pipeline.Workspace) -recurse | Select-Object -ExpandProperty FullName
6258
displayName: List all files in the workspace
6359

6460
- task: PowerShell@2
6561
inputs:
6662
targetType: inline
67-
pwsh: true
6863
script: |
6964
$releaseVersion = '$(ReleaseTag)' -replace '^v',''
7065
Write-Verbose -Verbose "Available modules: "
@@ -84,6 +79,17 @@ jobs:
8479
$endLine = $headingStartLines[1] - 1
8580

8681
$clContent = $changelog | Select-Object -Skip ($startLine-1) -First ($endLine - $startLine) | Out-String
82+
83+
$StringBuilder = [System.Text.StringBuilder]::new($clContent, $clContent.Length + 2kb)
84+
$StringBuilder.AppendLine().AppendLine() > $null
85+
$StringBuilder.AppendLine("### SHA256 Hashes of the release artifacts").AppendLine() > $null
86+
Get-ChildItem -Path "$(Pipeline.Workspace)/GitHubPackages/" -File | ForEach-Object {
87+
$PackageName = $_.Name
88+
$SHA256 = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash
89+
$StringBuilder.AppendLine("- $PackageName").AppendLine(" - $SHA256") > $null
90+
}
91+
92+
$clContent = $StringBuilder.ToString()
8793

8894
Write-Verbose -Verbose "Selected content: `n$clContent"
8995
@@ -100,11 +106,32 @@ jobs:
100106
}
101107
displayName: Set variables for GitHub release task
102108
103-
- pwsh: |
104-
Write-Host "ReleaseNotes content:"
105-
Get-Content "$(Pipeline.Workspace)/release-notes.md" -Raw | Out-String -width 9999 | Write-Host
109+
- task: PowerShell@2
110+
inputs:
111+
targetType: inline
112+
script: |
113+
Write-Host "ReleaseNotes content:"
114+
Get-Content "$(Pipeline.Workspace)/release-notes.md" -Raw | Out-String -width 9999 | Write-Host
106115
displayName: Verify Release Notes
107116
117+
- task: PowerShell@2
118+
inputs:
119+
targetType: inline
120+
script: |
121+
$middleURL = ''
122+
$tagString = "$(ReleaseTag)"
123+
Write-Verbose -Verbose "Use the following command to push the tag:"
124+
if ($tagString -match '-') {
125+
$middleURL = "preview"
126+
}
127+
elseif ($tagString -match '(\d+\.\d+)') {
128+
$middleURL = $matches[1]
129+
}
130+
$endURL = $tagString -replace '[v\.]',''
131+
$message = "https://github.com/PowerShell/PowerShell/blob/master/CHANGELOG/$middleURL.md#$endURL"
132+
Write-Verbose -Verbose "git tag -a $(ReleaseTag) $env:BUILD_SOURCEVERSION -m $message"
133+
displayName: Git Push Tag Command
134+
108135
- task: GitHubRelease@1
109136
inputs:
110137
gitHubConnection: GitHubReleasePAT
@@ -113,6 +140,7 @@ jobs:
113140
assets: '$(Pipeline.Workspace)/GitHubPackages/*'
114141
tagSource: 'userSpecifiedTag'
115142
tag: '$(ReleaseTag)'
143+
title: "$(ReleaseTag) Release of PowerShell"
116144
isDraft: true
117145
addChangeLog: false
118146
action: 'create'
@@ -136,28 +164,32 @@ jobs:
136164
VERSION: $[ stageDependencies.setReleaseTagAndChangelog.SetTagAndChangelog.outputs['OutputVersion.Version'] ]
137165
138166
steps:
139-
- template: release-install-pwsh.yml
140-
141-
- pwsh: |
142-
Write-Verbose -Verbose "Version: $(Version)"
143-
Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
167+
- task: PowerShell@2
168+
inputs:
169+
targetType: inline
170+
script: |
171+
Write-Verbose -Verbose "Version: $(Version)"
172+
Get-ChildItem Env: | Out-String -width 9999 -Stream | write-Verbose -Verbose
144173
displayName: 'Capture Environment Variables'
145174
146-
- pwsh: |
147-
#Exclude all global tool packages. Their names start with 'PowerShell.'
148-
$null = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/release"
149-
Copy-Item "$(Pipeline.Workspace)/NuGetPackages/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose
175+
- task: PowerShell@2
176+
inputs:
177+
targetType: inline
178+
script: |
179+
#Exclude all global tool packages. Their names start with 'PowerShell.'
180+
$null = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)/release"
181+
Copy-Item "$(Pipeline.Workspace)/NuGetPackages/*.nupkg" -Destination "$(Pipeline.Workspace)/release" -Exclude "PowerShell.*.nupkg" -Force -Verbose
150182
151-
$releaseVersion = '$(Version)'
152-
$globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"
183+
$releaseVersion = '$(Version)'
184+
$globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"
153185
154-
if ($releaseVersion -notlike '*-*') {
155-
# Copy the global tool package for stable releases
156-
Copy-Item $globalToolPath -Destination "$(Pipeline.Workspace)/release"
157-
}
186+
if ($releaseVersion -notlike '*-*') {
187+
# Copy the global tool package for stable releases
188+
Copy-Item $globalToolPath -Destination "$(Pipeline.Workspace)/release"
189+
}
158190
159-
Write-Verbose -Verbose "The .nupkgs below will be pushed:"
160-
Get-ChildItem "$(Pipeline.Workspace)/release" -recurse
191+
Write-Verbose -Verbose "The .nupkgs below will be pushed:"
192+
Get-ChildItem "$(Pipeline.Workspace)/release" -recurse
161193
displayName: Download and capture nupkgs
162194
condition: and(ne('${{ parameters.skipPublish }}', 'false'), succeeded())
163195

0 commit comments

Comments
 (0)
0