Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
[release/v7.5.6] Create infrastructure to create two msixs and msixbundles for LTS and Stable #27165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[release/v7.5.6] Create infrastructure to create two msixs and msixbundles for LTS and Stable #27165
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,17 +85,44 @@ jobs: | |
| $null = Copy-Item -Path $msixFile.FullName -Destination $sourceDir -Force -Verbose | ||
| } | ||
|
|
||
| $file = Get-ChildItem $sourceDir | Select-Object -First 1 | ||
| $prefix = ($file.BaseName -split "-win")[0] | ||
| $pkgName = "$prefix.msixbundle" | ||
| Write-Verbose -Verbose "Creating $pkgName" | ||
|
|
||
| $makeappx = '$(MakeAppxPath)' | ||
| $outputDir = "$sourceDir\output" | ||
| New-Item $outputDir -Type Directory -Force > $null | ||
| & $makeappx bundle /d $sourceDir /p "$outputDir\$pkgName" | ||
|
|
||
| Get-ChildItem -Path $sourceDir -Recurse | ||
| # Separate LTS and Stable/Preview MSIX files by filename convention | ||
| $ltsMsix = @(Get-ChildItem $sourceDir -Filter '*.msix' | Where-Object { $_.BaseName -match '-LTS-' }) | ||
| $stableMsix = @(Get-ChildItem $sourceDir -Filter '*.msix' | Where-Object { $_.BaseName -notmatch '-LTS-' }) | ||
|
|
||
| Write-Verbose -Verbose "Stable/Preview MSIX files: $($stableMsix.Name -join ', ')" | ||
| Write-Verbose -Verbose "LTS MSIX files: $($ltsMsix.Name -join ', ')" | ||
|
|
||
| # Create Stable/Preview bundle | ||
| if ($stableMsix.Count -gt 0) { | ||
| $stableDir = "$sourceDir\stable" | ||
| New-Item $stableDir -Type Directory -Force > $null | ||
| $stableMsix | Copy-Item -Destination $stableDir -Force | ||
| $file = $stableMsix | Select-Object -First 1 | ||
|
Comment on lines
88
to
+104
|
||
| $prefix = ($file.BaseName -split "-win")[0] | ||
| $stableBundleName = "$prefix.msixbundle" | ||
| Write-Verbose -Verbose "Creating Stable/Preview bundle: $stableBundleName" | ||
| & $makeappx bundle /d $stableDir /p "$outputDir\$stableBundleName" | ||
| } | ||
|
|
||
| # Create LTS bundle | ||
| if ($ltsMsix.Count -gt 0) { | ||
| $ltsDir = "$sourceDir\lts" | ||
| New-Item $ltsDir -Type Directory -Force > $null | ||
| $ltsMsix | Copy-Item -Destination $ltsDir -Force | ||
| $file = $ltsMsix | Select-Object -First 1 | ||
| $prefix = ($file.BaseName -split "-win")[0] | ||
| $ltsBundleName = "$prefix.msixbundle" | ||
| Write-Verbose -Verbose "Creating LTS bundle: $ltsBundleName" | ||
| & $makeappx bundle /d $ltsDir /p "$outputDir\$ltsBundleName" | ||
| } | ||
|
|
||
| Write-Verbose -Verbose "Created bundles:" | ||
| Get-ChildItem -Path $outputDir -Recurse | ||
|
|
||
| $vstsCommandString = "vso[task.setvariable variable=BundleDir]$outputDir" | ||
| Write-Host "sending " + $vstsCommandString | ||
| Write-Host "##$vstsCommandString" | ||
|
|
@@ -112,16 +139,18 @@ jobs: | |
| search_root: '$(BundleDir)' | ||
|
|
||
| - pwsh: | | ||
| $signedBundle = Get-ChildItem -Path $(BundleDir) -Filter "*.msixbundle" -File | ||
| Write-Verbose -Verbose "Signed bundle: $signedBundle" | ||
| $signedBundles = @(Get-ChildItem -Path $(BundleDir) -Filter "*.msixbundle" -File) | ||
| Write-Verbose -Verbose "Signed bundles: $($signedBundles.Name -join ', ')" | ||
|
|
||
| if (-not (Test-Path $(ob_outputDirectory))) { | ||
| New-Item -ItemType Directory -Path $(ob_outputDirectory) -Force | ||
| } | ||
|
|
||
| Copy-Item -Path $signedBundle.FullName -Destination "$(ob_outputDirectory)" -Verbose | ||
| foreach ($bundle in $signedBundles) { | ||
| Copy-Item -Path $bundle.FullName -Destination "$(ob_outputDirectory)" -Verbose | ||
| } | ||
|
Comment on lines
+142
to
+151
|
||
|
|
||
| Write-Verbose -Verbose "Uploaded Bundle:" | ||
| Write-Verbose -Verbose "Uploaded Bundles:" | ||
| Get-ChildItem -Path $(ob_outputDirectory) | Write-Verbose -Verbose | ||
| displayName: Upload msixbundle to Artifacts | ||
|
|
||
|
|
@@ -225,6 +254,29 @@ jobs: | |
| Write-Host "##vso[task.setvariable variable=ServiceConnection]$($config.ServiceEndpoint)" | ||
| Write-Host "##vso[task.setvariable variable=SBConfigPath]$($sbConfigPath)" | ||
|
|
||
| # Select the correct bundle based on channel | ||
| $bundleFiles = @(Get-ChildItem -Path '$(BundleDir)' -Filter '*.msixbundle') | ||
| Write-Verbose -Verbose "Available bundles: $($bundleFiles.Name -join ', ')" | ||
|
|
||
| if ($IsLTS) { | ||
| $bundleFile = $bundleFiles | Where-Object { $_.Name -match '-LTS-' } | ||
| } else { | ||
| # Catches Stable or Preview | ||
| $bundleFile = $bundleFiles | Where-Object { $_.Name -notmatch '-LTS-' } | ||
| } | ||
|
|
||
| if (-not $bundleFile) { | ||
| Write-Error "No matching bundle found for channel '$currentChannel'. Available bundles: $($bundleFiles.Name -join ', ')" | ||
| exit 1 | ||
| } | ||
|
|
||
| # Copy the selected bundle to a dedicated directory for store packaging | ||
| $storeBundleDir = '$(Pipeline.Workspace)\releasePipeline\msix\store-bundle' | ||
| New-Item $storeBundleDir -Type Directory -Force > $null | ||
| Copy-Item -Path $bundleFile.FullName -Destination $storeBundleDir -Force -Verbose | ||
| Write-Host "##vso[task.setvariable variable=StoreBundleDir]$storeBundleDir" | ||
|
Comment on lines
+257
to
+277
|
||
| Write-Verbose -Verbose "Selected bundle for store packaging: $($bundleFile.Name)" | ||
|
|
||
| # These variables are used in the next tasks to determine which ServiceEndpoint to use | ||
| $ltsValue = $IsLTS.ToString().ToLower() | ||
| $stableValue = $IsStable.ToString().ToLower() | ||
|
|
@@ -256,7 +308,7 @@ jobs: | |
| inputs: | ||
| serviceEndpoint: 'StoreAppPublish-Preview' | ||
| sbConfigPath: '$(SBConfigPath)' | ||
| sourceFolder: '$(BundleDir)' | ||
| sourceFolder: '$(StoreBundleDir)' | ||
| contents: '*.msixBundle' | ||
| outSBName: 'PowerShellStorePackage' | ||
| pdpPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDP/PDP' | ||
|
|
@@ -268,7 +320,7 @@ jobs: | |
| inputs: | ||
| serviceEndpoint: 'StoreAppPublish-Private' | ||
| sbConfigPath: '$(SBConfigPath)' | ||
| sourceFolder: '$(BundleDir)' | ||
| sourceFolder: '$(StoreBundleDir)' | ||
| contents: '*.msixBundle' | ||
| outSBName: 'PowerShellStorePackage' | ||
| pdpPath: '$(System.DefaultWorkingDirectory)/PowerShell/.pipelines/store/PDP/PDP' | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4257,18 +4257,8 @@ function New-MSIXPackage | |||||
|
|
||||||
| $makepri = Get-Item (Join-Path $makeappx.Directory "makepri.exe") -ErrorAction Stop | ||||||
|
|
||||||
| $displayName = $ProductName | ||||||
| $ProductSemanticVersion = Get-PackageSemanticVersion -Version $ProductVersion | ||||||
| $productSemanticVersionWithName = $ProductName + '-' + $ProductSemanticVersion | ||||||
| $packageName = $productSemanticVersionWithName | ||||||
| if ($Private) { | ||||||
| $ProductNameSuffix = 'Private' | ||||||
| } | ||||||
|
|
||||||
| if ($ProductNameSuffix) { | ||||||
| $packageName += "-$ProductNameSuffix" | ||||||
| } | ||||||
|
|
||||||
| $displayName = $productName | ||||||
|
|
||||||
| if ($Private) { | ||||||
| $ProductName = 'PowerShell-Private' | ||||||
|
|
@@ -4284,6 +4274,13 @@ function New-MSIXPackage | |||||
| Write-Verbose -Verbose "ProductName: $productName" | ||||||
| Write-Verbose -Verbose "DisplayName: $displayName" | ||||||
|
|
||||||
| $packageName = $ProductName + '-' + $ProductSemanticVersion | ||||||
|
|
||||||
| # Appends Architecture to the package name | ||||||
|
||||||
| # Appends Architecture to the package name | |
| # Appends the product name/runtime suffix (for example, win-x64 or win-arm64) to the package name |

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bundling step succeeds even if no
.msixfiles are present (both$stableMsixand$ltsMsixcan be empty), which can let the job continue and later publish nothing. Consider explicitly validating that at least one.msixwas found and failing the step early with a clear error message.