@@ -138,12 +138,6 @@ extends:
138138 if (-not $matched) {
139139 throw "Release tag must be in the format v#.#.#, such as 'v7.4.3'. Current version: $releaseTag"
140140 }
141-
142- # Extract minor version and verify it's even (LTS versions only)
143- $minorVersion = [int]$Matches[1]
144- if($minorVersion % 2 -ne 0) {
145- throw "Only release msixbundle vpack for LTS releases. Current version: $releaseTag"
146- }
147141 displayName: Stop any preview release
148142 env:
149143 ob_restore_phase: true
@@ -270,174 +264,85 @@ extends:
270264
271265 Write-Verbose -Message "checking pwsh exists in $signedFilesPath" -Verbose
272266 if (-not (Test-Path $signedFilesPath\pwsh.exe)) {
273- throw "pwsh.exe not found in $signedFilesPath"
267+ throw "pwsh.exe not found in $signedFilesPath"
274268 }
275269
276270 Write-Verbose -Message "Restoring PSOptions from $psoptionsFilePath" -Verbose
277271
278272 Restore-PSOptions -PSOptionsPath "$psoptionsFilePath"
279273 Get-PSOptions | Write-Verbose -Verbose
280274
281- ## Generated packages are placed in the current directory by default.
282- Set-Location $repoRoot
283- Start-PSPackage -Type msix -SkipReleaseChecks -WindowsRuntime $runtime -ReleaseTag $(ReleaseTagVar) -PackageBinPath $signedFilesPath -LTS
284-
285- $msixPkgNameFilter = "PowerShell*.msix"
286- $msixPkgFile = Get-ChildItem -Path $repoRoot -Filter $msixPkgNameFilter -File
287- $msixPkgPath = $msixPkgFile.FullName
288- Write-Verbose -Verbose "Unsigned msix package: $msixPkgPath"
289-
290- $pkgDir = '$(ob_outputDirectory)\pkgs'
291- $null = New-Item -ItemType Directory -Path $pkgDir -Force
292- Copy-Item -Path $msixPkgPath -Destination $pkgDir -Force -Verbose
293- displayName: 'Build MSIX Package (Unsigned)'
294-
295- # ## END OF Packaging ###
296-
297- - pwsh : |
298- Get-ChildItem -Path '$(ob_outputDirectory)\pkgs' -Recurse
299- displayName: 'List Unsigned Package'
300-
301- - stage : Pack_MSIXBundle_And_Sign
302- displayName : ' Pack and sign MSIXBundle'
303- dependsOn : [Build_MSIX_Package]
304- jobs :
305- - job : Bundle
306- pool :
307- type : windows
308- variables :
309- ArtifactPlatform : ' windows'
310- ob_outputDirectory : ' $(BUILD.SOURCESDIRECTORY)\out'
311- ob_artifactBaseName : drop_pack_msixbundle
312- ob_createvpack_enabled : ${{ parameters.createVPack }}
313- ob_createvpack_packagename : ' PowerShell7.Store.app'
314- ob_createvpack_owneralias : ' dongbow'
315- ob_createvpack_description : ' VPack for the PowerShell 7 Store Application'
316- ob_createvpack_targetDestinationDirectory : ' $(Destination)' # # The value is from the 'CreateVpack' task, used when pulling the generated VPack.
317- ob_createvpack_propsFile : false
318- ob_createvpack_provData : true
319- ob_createvpack_metadata : ' $(Build.SourceVersion)'
320- ob_createvpack_versionAs : string
321- ob_createvpack_version : ' $(Version)'
322- ob_createvpack_verbose : true
323-
324- steps :
325- - checkout : self
326- displayName : Checkout source code - during restore
327- clean : true
328- path : s # # $(Build.SourcesDirectory) is at '$(Pipeline.Workspace)\s', so we need to check out repo to the 's' folder.
329- env :
330- ob_restore_phase : true
275+ $metadata = Get-Content "$repoRoot\tools\metadata.json" -Raw | ConvertFrom-Json
276+ Write-Verbose -Verbose "metadata:"
277+ $metadata | Out-String | Write-Verbose -Verbose
331278
332- - template : /.pipelines/templates/SetVersionVariables.yml@self
333- parameters :
334- ReleaseTagVar : $(ReleaseTagVar)
335- CreateJson : no
279+ $publishLTS = $metadata.LTSRelease.PublishToChannels
280+ $publishStable = $metadata.StableRelease.PublishToChannels
336281
337- - template : /.pipelines/templates/shouldSign.yml@self
282+ Write-Verbose -Verbose "Publish LTS: $publishLTS"
283+ Write-Verbose -Verbose "Publish Stable: $publishStable"
338284
339- - task : DownloadPipelineArtifact@2
340- inputs :
341- artifactName : drop_build_x64
342- itemPattern : |
343- **/*.msix
344- targetPath : ' $(Build.ArtifactStagingDirectory)\downloads'
345- displayName : Download msix for x64
285+ if (-not $publishLTS -and -not $publishStable) {
286+ throw "metadata.json indicates no channels to publish to."
287+ }
346288
347- - task : DownloadPipelineArtifact@2
348- inputs :
349- artifactName : drop_build_arm64
350- itemPattern : |
351- **/*.msix
352- targetPath : ' $(Build.ArtifactStagingDirectory)\downloads'
353- displayName : Download msix for arm64
289+ ## Generated packages are placed in the current directory by default.
290+ Set-Location $repoRoot
291+ Start-PSPackage -Type msix -SkipReleaseChecks -WindowsRuntime $runtime -ReleaseTag $(ReleaseTagVar) -PackageBinPath $signedFilesPath -LTS:$publishLTS
354292
355- # Finds the makeappx tool on the machine.
356- - pwsh : |
357- Write-Verbose -Verbose 'PowerShell Version: $(Version)'
358- $cmd = Get-Command makeappx.exe -ErrorAction Ignore
359- if ($cmd) {
360- Write-Verbose -Verbose 'makeappx available in PATH'
361- $exePath = $cmd.Source
362- } else {
363- $makeappx = Get-ChildItem -Recurse 'C:\Program Files (x86)\Windows Kits\10\makeappx.exe' |
364- Where-Object { $_.DirectoryName -match 'x64' } |
365- Select-Object -Last 1
366- $exePath = $makeappx.FullName
367- Write-Verbose -Verbose "makeappx was found: $exePath"
293+ if ($publishLTS -and $publishStable) {
294+ $enabledChannels = "LTS,Stable"
295+ Write-Verbose -Verbose "Publish to both LTS and Stable channels. Building additional Stable MSIX."
296+ Start-PSPackage -Type msix -SkipReleaseChecks -WindowsRuntime $runtime -ReleaseTag $(ReleaseTagVar) -PackageBinPath $signedFilesPath
368297 }
369- $vstsCommandString = "vso[task.setvariable variable=MakeAppxPath]$exePath"
370- Write-Host ("sending " + $vstsCommandString)
371- Write-Host "##$vstsCommandString"
372- displayName: Find makeappx tool
373- retryCountOnTaskFailure: 1
374298
375- - pwsh : |
376- $sourceDir = '$(Pipeline.Workspace)\releasePipeline\msix'
377- $null = New-Item -Path $sourceDir -ItemType Directory -Force
299+ $msixPkgNameFilter = "PowerShell*.msix"
300+ $msixPkgFile = Get-ChildItem -Path $repoRoot -Filter $msixPkgNameFilter -Recurse -File | ForEach-Object FullName
301+ Write-Verbose -Verbose "Unsigned msix package(s): $msixPkgFile"
378302
379- $msixFiles = Get-ChildItem -Path "$(Build.ArtifactStagingDirectory)\downloads\*.msix" -Recurse
380- foreach ($msixFile in $msixFiles) {
381- $null = Copy-Item -Path $msixFile.FullName -Destination $sourceDir -Force -Verbose
382- }
303+ $pkgDir = '$(ob_outputDirectory)\pkgs'
304+ $null = New-Item -ItemType Directory -Path $pkgDir -Force
305+ Copy-Item -Path $msixPkgFile -Destination $pkgDir -Force -Verbose
383306
384- $file = Get-ChildItem $sourceDir | Select-Object -First 1
385- $prefix = ($file.BaseName -split "-win")[0]
386- $pkgName = "$prefix.msixbundle"
387- Write-Verbose -Verbose "Creating $pkgName"
388-
389- $makeappx = '$(MakeAppxPath)'
390- $outputDir = "$sourceDir\output"
391- New-Item $outputDir -Type Directory -Force > $null
392- & $makeappx bundle /d $sourceDir /p "$outputDir\$pkgName"
393- if ($LASTEXITCODE -ne 0) {
394- throw "makeappx bundle failed with exit code $LASTEXITCODE"
307+ if (-not $enabledChannels) {
308+ $enabledChannels = $publishLTS ? 'LTS' : ($publishStable ? 'Stable' : 'None')
395309 }
396310
397- Get-ChildItem -Path $sourceDir -Recurse | Out-String -Width 200
398- $vstsCommandString = "vso[task.setvariable variable=BundleDir]$outputDir "
311+ ## Create an output variable for the enabled channels so that downstream stages can use it.
312+ $vstsCommandString = "vso[task.setvariable variable=EnabledChannels;isOutput=true]$enabledChannels "
399313 Write-Host ("sending " + $vstsCommandString)
400314 Write-Host "##$vstsCommandString"
401- displayName: Create MsixBundle
402- retryCountOnTaskFailure: 1
315+ name: BuildMSIXPackage
316+ displayName: 'Build MSIX Package (Unsigned)'
403317
404- - task : onebranch.pipeline.signing@1
405- displayName : Sign MsixBundle
406- inputs :
407- command : ' sign'
408- signing_profile : $(MSIXProfile)
409- files_to_sign : ' **/*.msixbundle'
410- search_root : ' $(BundleDir)'
318+ # ## END OF Packaging ###
411319
412320 - pwsh : |
413- $signedBundle = Get-ChildItem -Path $(BundleDir) -Filter "*.msixbundle" -File
414- Write-Verbose -Verbose "Signed bundle: $signedBundle"
415-
416- $signature = Get-AuthenticodeSignature -FilePath $signedBundle.FullName
417- if ($signature.Status -ne 'Valid') {
418- throw "The bundle file doesn't have a valid signature. Signature status: $($signature.Status)"
419- }
321+ Get-ChildItem -Path '$(ob_outputDirectory)\pkgs' -Recurse
322+ displayName: 'List Unsigned Package'
420323
421- if (-not (Test-Path '$(ob_outputDirectory)' -PathType Container)) {
422- $null = New-Item '$(ob_outputDirectory)' -ItemType Directory -ErrorAction Stop
423- }
324+ - pwsh : |
325+ $signedFilesPath = '$(ob_outputDirectory)\Signed-$(Runtime)'
326+ Remove-Item -Path $signedFilesPath -Recurse -Force -Verbose
327+ displayName: 'Remove Signed-$(Runtime) folder'
424328
425- $targetPath = Join-Path '$(ob_outputDirectory)' 'Microsoft.PowerShell-LTS_8wekyb3d8bbwe.msixbundle'
426- Copy-Item -Verbose -Path $signedBundle.FullName -Destination $targetPath
329+ - stage : Pack_MSIXBundle_And_Sign
330+ displayName : ' Pack and sign MSIXBundle'
331+ dependsOn : [Build_MSIX_Package]
427332
428- Write-Verbose -Verbose "Uploaded Bundle:"
429- Get-ChildItem -Path $(ob_outputDirectory) | Out-String -Width 200 -Stream | Write-Verbose -Verbose
430- displayName: 'Stage msixbundle for VPack'
333+ variables :
334+ EnabledChannels : $[ stageDependencies.Build_MSIX_Package.Build.outputs['x64.BuildMSIXPackage.EnabledChannels'] ]
431335
432- - pwsh : |
433- Write-Verbose "VPack Version: $(ob_createvpack_version)" -Verbose
434- $vpackFiles = Get-ChildItem -Path '$(ob_outputDirectory)\*' -Recurse
435- if($vpackFiles.Count -eq 0) {
436- throw "No files found in $(ob_outputDirectory)"
437- }
438- $vpackFiles | Out-String -Width 200
439- displayName: Debug Output Directory and Version
440- condition: succeededOrFailed()
336+ jobs :
337+ - template : /.pipelines/templates/create-msixbundle-vpack.yml@self
338+ parameters :
339+ Channel : ' LTS'
340+ createVPack : ${{ parameters.createVPack }}
341+
342+ - template : /.pipelines/templates/create-msixbundle-vpack.yml@self
343+ parameters :
344+ Channel : ' Stable'
345+ createVPack : ${{ parameters.createVPack }}
441346
442347 - stage : Publish_Symbols
443348 displayName : ' Publish Symbols'
0 commit comments