From 21f31793263d411c17ae676855f431b357211b64 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Fri, 25 Apr 2025 18:00:49 -0500 Subject: [PATCH] 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. --- .../job-merge-msix-into-bundle.yml | 4 ++++ .../Draft-TerminalReleases.ps1 | 21 ++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/build/pipelines/templates-v2/job-merge-msix-into-bundle.yml b/build/pipelines/templates-v2/job-merge-msix-into-bundle.yml index 1668dcfb29..261750db8f 100644 --- a/build/pipelines/templates-v2/job-merge-msix-into-bundle.yml +++ b/build/pipelines/templates-v2/job-merge-msix-into-bundle.yml @@ -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) }}: diff --git a/tools/ReleaseEngineering/Draft-TerminalReleases.ps1 b/tools/ReleaseEngineering/Draft-TerminalReleases.ps1 index 5d3775892e..3da91ff51a 100644 --- a/tools/ReleaseEngineering/Draft-TerminalReleases.ps1 +++ b/tools/ReleaseEngineering/Draft-TerminalReleases.ps1 @@ -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" }