release-engineering: package (during build) and upload GPO templates (#18841)

I've been doing this manually. It is time for me to do it not-manually.

(cherry picked from commit 21f31793263d411c17ae676855f431b357211b64)
Service-Card-Id: PVTI_lADOAF3p4s4AxadtzgZwVgg
Service-Version: 1.23
This commit is contained in:
Dustin L. Howett 2025-04-25 18:00:49 -05:00 committed by Dustin L. Howett
parent 24a35cedcf
commit 4aa4d4a989
2 changed files with 20 additions and 5 deletions

View File

@ -147,6 +147,10 @@ jobs:
ValidateSignature: true
Verbosity: 'Verbose'
- pwsh: |-
tar -c -v --format=zip -f "$(JobOutputDirectory)/GroupPolicyTemplates_$(XES_APPXMANIFESTVERSION).zip" -C "$(Build.SourcesDirectory)/policies" *
displayName: Package GPO Templates
- ${{ parameters.afterBuildSteps }}
- ${{ if eq(parameters.publishArtifacts, true) }}:

View File

@ -30,6 +30,7 @@ Enum AssetType {
Unknown
ApplicationBundle
PreinstallKit
GroupPolicy
Zip
}
@ -83,6 +84,9 @@ Class Asset {
$local:bundlePath = Join-Path $local:directory $local:bundleName
$this.Type = [AssetType]::PreinstallKit
$this.Architecture = "all"
} ElseIf (".zip" -eq $local:ext -and $local:filename -like 'GroupPolicy*') {
$this.Type = [AssetType]::GroupPolicy
$this.Architecture = "all"
} ElseIf (".zip" -eq $local:ext) {
$this.Type = [AssetType]::Zip
} ElseIf (".msixbundle" -eq $local:ext) {
@ -90,7 +94,7 @@ Class Asset {
$this.Architecture = "all"
}
If ($this.Type -Ne [AssetType]::Zip) {
If ($this.Type -In ([AssetType]::ApplicationBundle, [AssetType]::PreinstallKit)) {
Write-Verbose "Cracking bundle $($local:bundlePath)"
$local:firstMsixName = & $script:tar -t -f $local:bundlePath |
Select-String 'Cascadia.*\.msix' |
@ -105,8 +109,10 @@ Class Asset {
$local:Manifest = [xml](Get-Content (Join-Path $local:directory AppxManifest.xml))
$this.ParseManifest($local:Manifest)
} Else {
& $script:tar -x -f $this.Path -C $local:directory --strip-components=1 '*/wt.exe'
$this.ExpandedVersion = (Get-Item (Join-Path $local:directory wt.exe)).VersionInfo.ProductVersion
If ($this.Type -Ne [AssetType]::GroupPolicy) {
& $script:tar -x -f $this.Path -C $local:directory --strip-components=1 '*/wt.exe'
$this.ExpandedVersion = (Get-Item (Join-Path $local:directory wt.exe)).VersionInfo.ProductVersion
}
# Zip files just encode everything in their filename. Not great, but workable.
$this.ParseFilename($local:filename)
@ -133,7 +139,9 @@ Class Asset {
$parts = [IO.Path]::GetFileNameWithoutExtension($filename).Split("_")
$this.Name = $parts[0]
$this.Version = $parts[1]
$this.Architecture = $parts[2]
If ($parts.Length -Ge 3) {
$this.Architecture = $parts[2]
}
}
[string]IdealFilename() {
@ -149,6 +157,9 @@ Class Asset {
Zip {
"{0}_{1}_{2}.zip" -f ($this.Name, $this.Version, $this.Architecture)
}
GroupPolicy {
"{0}_{1}.zip" -f ($this.Name, $this.Version)
}
Default {
Throw "Unknown type $($_.Type)"
}
@ -174,7 +185,7 @@ class Release {
Release([Asset[]]$a) {
$this.Assets = $a
$this.Branding = $a[0].Branding
$this.Branding = $a | Where-Object Branding -Ne ([Branding]::Unknown) | Select -Unique -First 1 -Expand Branding
$this.Name = Switch($this.Branding) {
Release { "Windows Terminal" }
Preview { "Windows Terminal Preview" }