30
30
Get-ChildItem Env: | Out-String -Stream | Write-Verbose -Verbose
31
31
displayName : ' Capture Environment Variables'
32
32
33
- - template : release-install-pwsh.yml
34
-
35
33
- task : PowerShell@2
36
34
inputs :
37
35
targetType : inline
38
- pwsh : true
39
36
script : |
40
37
$Path = "$(Pipeline.Workspace)/GitHubPackages"
41
38
$OutputPath = Join-Path $Path 'hashes.sha256'
@@ -56,15 +53,13 @@ jobs:
56
53
- task : PowerShell@2
57
54
inputs :
58
55
targetType : inline
59
- pwsh : true
60
56
script : |
61
57
Get-ChildItem $(Pipeline.Workspace) -recurse | Select-Object -ExpandProperty FullName
62
58
displayName : List all files in the workspace
63
59
64
60
- task : PowerShell@2
65
61
inputs :
66
62
targetType : inline
67
- pwsh : true
68
63
script : |
69
64
$releaseVersion = '$(ReleaseTag)' -replace '^v',''
70
65
Write-Verbose -Verbose "Available modules: "
84
79
$endLine = $headingStartLines[1] - 1
85
80
86
81
$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()
87
93
88
94
Write-Verbose -Verbose "Selected content : ` n$clContent"
89
95
@@ -100,11 +106,32 @@ jobs:
100
106
}
101
107
displayName: Set variables for GitHub release task
102
108
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
106
115
displayName: Verify Release Notes
107
116
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
+
108
135
- task: GitHubRelease@1
109
136
inputs:
110
137
gitHubConnection: GitHubReleasePAT
@@ -113,6 +140,7 @@ jobs:
113
140
assets: '$(Pipeline.Workspace)/GitHubPackages/*'
114
141
tagSource: 'userSpecifiedTag'
115
142
tag: '$(ReleaseTag)'
143
+ title: "$(ReleaseTag) Release of PowerShell"
116
144
isDraft: true
117
145
addChangeLog: false
118
146
action: 'create'
@@ -136,28 +164,32 @@ jobs:
136
164
VERSION: $[ stageDependencies.setReleaseTagAndChangelog.SetTagAndChangelog.outputs['OutputVersion.Version'] ]
137
165
138
166
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
144
173
displayName: 'Capture Environment Variables'
145
174
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
150
182
151
- $releaseVersion = '$(Version)'
152
- $globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"
183
+ $releaseVersion = '$(Version)'
184
+ $globalToolPath = "$(Pipeline.Workspace)/NuGetPackages/PowerShell.$releaseVersion.nupkg"
153
185
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
+ }
158
190
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
161
193
displayName: Download and capture nupkgs
162
194
condition: and(ne('${{ parameters.skipPublish }}', 'false'), succeeded())
163
195
0 commit comments