Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .pipelines/MSIXBundle-vPack-Official.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
trigger: none

parameters: # parameters are shown up in ADO UI in a build queue time
- name: 'createVPack'
displayName: 'Create and Submit VPack'
type: boolean
default: true
- name: 'debug'
displayName: 'Enable debug output'
type: boolean
default: false
- name: 'ReleaseTagVar'
type: string
displayName: 'Release Tag Var:'
default: 'fromBranch'

name: msixbundle_vPack_$(date:yyMM).$(date:dd)$(rev:rrr)

variables:
CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)]
system.debug: ${{ parameters.debug }}
BuildSolution: $(Build.SourcesDirectory)\dirs.proj
ReleaseTagVar: ${{ parameters.ReleaseTagVar }}
BuildConfiguration: Release
WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest'
Codeql.Enabled: false # pipeline is not building artifacts; it repackages existing artifacts into a vpack
DOTNET_CLI_TELEMETRY_OPTOUT: 1
POWERSHELL_TELEMETRY_OPTOUT: 1

resources:
repositories:
- repository: templates
type: git
name: OneBranch.Pipelines/GovernedTemplates
ref: refs/heads/main

pipelines:
- pipeline: PSPackagesOfficial
source: 'PowerShell-Packages-Official'
trigger:
branches:
include:
- master
- releases/*

extends:
template: v2/Microsoft.Official.yml@templates
parameters:
platform:
name: 'windows_undocked' # windows undocked

cloudvault:
enabled: false

globalSdl:
useCustomPolicy: true # for signing code
disableLegacyManifest: true
# disabled Armory as we dont have any ARM templates to scan. It fails on some sample ARM templates.
armory:
enabled: false
sbom:
enabled: true
compiled:
enabled: false
credscan:
enabled: true
scanFolder: $(Build.SourcesDirectory)
suppressionsFile: $(Build.SourcesDirectory)\.config\suppress.json
binskim:
enabled: false
# APIScan requires a non-Ready-To-Run build
apiscan:
enabled: false
asyncSDL:
enabled: false
tsaOptionsFile: .config/tsaoptions.json

stages:
- stage: build
jobs:
- job: main
pool:
type: windows

variables:
ob_outputDirectory: '$(BUILD.SOURCESDIRECTORY)\out'
ob_createvpack_enabled: ${{ parameters.createVPack }}
ob_createvpack_packagename: 'PowerShell.app'
ob_createvpack_owneralias: 'dongbow'
ob_createvpack_description: 'VPack for the PowerShell Application'
ob_createvpack_targetDestinationDirectory: '$(Destination)'
ob_createvpack_propsFile: false
ob_createvpack_provData: true
ob_createvpack_metadata: '$(Build.SourceVersion)'
ob_createvpack_versionAs: string
ob_createvpack_version: '$(version)'
ob_createvpack_verbose: true

steps:
- template: .pipelines/templates/SetVersionVariables.yml@self
parameters:
ReleaseTagVar: $(ReleaseTagVar)
UseJson: no
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to .pipelines/templates/SetVersionVariables.yml@self passes UseJson, but the template defines the parameter as CreateJson. Azure Pipelines template expansion will fail with an unexpected-parameter error. Rename UseJson to CreateJson (e.g., CreateJson: 'no') to match the template signature.

Suggested change
UseJson: no
CreateJson: no

Copilot uses AI. Check for mistakes.

- pwsh: |
Write-Verbose -Verbose 'PowerShell Version: $(version)'
if('$(version)' -match '-') {
throw "Don't release a preview build msixbundle package"
}
displayName: Stop any preview release

- download: PSPackagesOfficial
artifact: 'drop_msixbundle_CreateMSIXBundle'
displayName: Download package

- pwsh: |
$payloadDir = '$(Pipeline.Workspace)\PSPackagesOfficial\drop_msixbundle_CreateMSIXBundle'
Get-ChildItem $payloadDir -Recurse | Out-String -Width 150
$vstsCommandString = "vso[task.setvariable variable=PayloadDir]$payloadDir"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: 'Capture Artifact Listing'

- pwsh: |
$bundlePackage = Get-ChildItem '$(PayloadDir)\*.msixbundle'
Write-Verbose -Verbose ("MSIX bundle package: " + $bundlePackage.FullName -join ', ')
if ($bundlePackage.Count -ne 1) {
throw "Expected to find 1 MSIX bundle package, but found $($bundlePackage.Count)"
}

if (-not (Test-Path '$(ob_outputDirectory)' -PathType Container)) {
$null = New-Item '$(ob_outputDirectory)' -ItemType Directory -ErrorAction Stop
}

$targetPath = Join-Path '$(ob_outputDirectory)' 'Microsoft.PowerShell_8wekyb3d8bbwe.msixbundle'
Copy-Item -Verbose -Path $bundlePackage.FullName -Destination $targetPath
displayName: 'Stage msixbundle for vpack'

- pwsh: |
Write-Verbose "VPack Version: $(ob_createvpack_version)" -Verbose
$vpackFiles = Get-ChildItem -Path $(ob_outputDirectory)\* -Recurse
if($vpackFiles.Count -eq 0) {
throw "No files found in $(ob_outputDirectory)"
}
$vpackFiles | Out-String -Width 150
displayName: Debug Output Directory and Version
condition: succeededOrFailed()
1 change: 1 addition & 0 deletions assets/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@
<rescap:Capability Name="packageManagement" />
<rescap:Capability Name="packageQuery" />
</Capabilities>
<mp:PhoneIdentity PhoneProductId="$PHONEPRODUCTID$" PhonePublisherId="95d94207-0c7c-47ed-82db-d75c81153c35" />
</Package>
18 changes: 17 additions & 1 deletion tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4286,8 +4286,17 @@ function New-MSIXPackage

$ProductVersion = Get-WindowsVersion -PackageName $packageName

# Any app that is submitted to the Store must have a PhoneIdentity in its appxmanifest.
# If you submit a package without this information to the Store, the Store will silently modify your package to include it.
# To find the PhoneProductId value, you need to run a package through the Store certification process,
# and use the PhoneProductId value from the Store certified package to update the manifest in your source code.
# This is the PhoneProductId for the "Microsoft.PowerShell" package.
$PhoneProductId = "5b3ae196-2df7-446e-8060-94b4ad878387"

$isPreview = Test-IsPreview -Version $ProductSemanticVersion
if ($isPreview) {
# This is the PhoneProductId for the "Microsoft.PowerShellPreview" package.
$PhoneProductId = "67859fd2-b02a-45be-8fb5-62c569a3e8bf"
Write-Verbose "Using Preview assets" -Verbose
} elseif ($LTS) {
# This is the PhoneProductId for the "Microsoft.PowerShell-LTS" package.
Expand All @@ -4301,7 +4310,14 @@ function New-MSIXPackage
$releasePublisher = 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'

$appxManifest = Get-Content "$RepoRoot\assets\AppxManifest.xml" -Raw
$appxManifest = $appxManifest.Replace('$VERSION$', $ProductVersion).Replace('$ARCH$', $Architecture).Replace('$PRODUCTNAME$', $productName).Replace('$DISPLAYNAME$', $displayName).Replace('$PUBLISHER$', $releasePublisher)
$appxManifest = $appxManifest.
Replace('$VERSION$', $ProductVersion).
Replace('$ARCH$', $Architecture).
Replace('$PRODUCTNAME$', $productName).
Replace('$DISPLAYNAME$', $displayName).
Replace('$PUBLISHER$', $releasePublisher).
Replace('$PHONEPRODUCTID$', $PhoneProductId)

$xml = [xml]$appxManifest
if ($isPreview) {
Write-Verbose -Verbose "Adding pwsh-preview.exe alias"
Expand Down
Loading