1
0
mirror of https://github.com/PowerShell/PowerShell synced 2025-10-06 00:22:59 +02:00

Publish .msixbundle package as a VPack (#25612)

This commit is contained in:
Dongbo Wang
2025-05-30 10:23:48 -07:00
committed by GitHub
parent 5851796664
commit 70b4bda20f
5 changed files with 171 additions and 6 deletions

View File

@@ -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
- 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()

View File

@@ -368,10 +368,11 @@ extends:
jobs: jobs:
- template: /.pipelines/templates/approvalJob.yml@self - template: /.pipelines/templates/approvalJob.yml@self
parameters: parameters:
displayName: Start vPack Release pipeline displayName: Start 2 vPack Release pipelines
jobName: PublishVPack jobName: PublishVPack
instructions: | instructions: |
Kick off vPack release pipeline 1. Kick off PowerShell-vPack-Official pipeline
2. Kick off PowerShell-MSIXBundle-VPack pipeline
# Need to verify if the Az PS / CLI team still uses this. Skippinng for this release. # Need to verify if the Az PS / CLI team still uses this. Skippinng for this release.
# - stage: ReleaseDeps # - stage: ReleaseDeps

View File

@@ -23,7 +23,7 @@ steps:
} }
if(Test-Path -Path $path) if(Test-Path -Path $path)
{ {
Write-Verbose "reporoot detect at: ." -Verbose Write-Verbose "reporoot detected at: ." -Verbose
$repoRoot = '.' $repoRoot = '.'
} }
else{ else{
@@ -51,7 +51,7 @@ steps:
$REPOROOT = $env:REPOROOT $REPOROOT = $env:REPOROOT
if (-not (Test-Path $REPOROOT/tools/releaseBuild/setReleaseTag.ps1)) { if (-not (Test-Path $REPOROOT/tools/releaseBuild/setReleaseTag.ps1)) {
if ((Test-Path "$REPOROOT/PowerShell/tools/releaseBuild/setReleaseTag.ps1")) { if (Test-Path "$REPOROOT/PowerShell/tools/releaseBuild/setReleaseTag.ps1") {
$REPOROOT = "$REPOROOT/PowerShell" $REPOROOT = "$REPOROOT/PowerShell"
} else { } else {
throw "Could not find setReleaseTag.ps1 in $REPOROOT/tools/releaseBuild or $REPOROOT/PowerShell/tools/releaseBuild" throw "Could not find setReleaseTag.ps1 in $REPOROOT/tools/releaseBuild or $REPOROOT/PowerShell/tools/releaseBuild"
@@ -72,7 +72,7 @@ steps:
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue
- powershell: | - powershell: |
Get-ChildItem -Path env: | Out-String -width 9999 -Stream | write-Verbose -Verbose Get-ChildItem -Path Env: | Out-String -Width 150
displayName: Capture environment displayName: Capture environment
condition: succeededOrFailed() condition: succeededOrFailed()
env: env:

View File

@@ -48,4 +48,5 @@
<rescap:Capability Name="packageManagement" /> <rescap:Capability Name="packageManagement" />
<rescap:Capability Name="packageQuery" /> <rescap:Capability Name="packageQuery" />
</Capabilities> </Capabilities>
<mp:PhoneIdentity PhoneProductId="$PHONEPRODUCTID$" PhonePublisherId="95d94207-0c7c-47ed-82db-d75c81153c35" />
</Package> </Package>

View File

@@ -3707,8 +3707,17 @@ function New-MSIXPackage
$ProductVersion = Get-WindowsVersion -PackageName $packageName $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 $isPreview = Test-IsPreview -Version $ProductSemanticVersion
if ($isPreview) { if ($isPreview) {
# This is the PhoneProductId for the "Microsoft.PowerShellPreview" package.
$PhoneProductId = "67859fd2-b02a-45be-8fb5-62c569a3e8bf"
Write-Verbose "Using Preview assets" -Verbose Write-Verbose "Using Preview assets" -Verbose
} }
@@ -3718,7 +3727,14 @@ function New-MSIXPackage
$releasePublisher = 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US' $releasePublisher = 'CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US'
$appxManifest = Get-Content "$RepoRoot\assets\AppxManifest.xml" -Raw $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 $xml = [xml]$appxManifest
if ($isPreview) { if ($isPreview) {
Write-Verbose -Verbose "Adding pwsh-preview.exe alias" Write-Verbose -Verbose "Adding pwsh-preview.exe alias"