Skip to content

Commit ee89712

Browse files
Add PowerShell dependency to winget manifests
Re-applies the change from PR #1497 which was reverted in PR #1548. The original broke the workflow YAML because the PowerShell here-string content and closing tag had zero indentation, which terminated the YAML literal block scalar (run: |). Fixed by indenting the here-string body to match the block indentation level; YAML strips the leading spaces, leaving valid PowerShell with the closing tag at column 0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent befad01 commit ee89712

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

.github/workflows/winget.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,24 @@ jobs:
4141
.\wingetcreate.exe update $packageId `
4242
--version $packageVersion `
4343
--urls "$installerUrlx64|x64" "$installerUrlarm64|arm64" `
44-
--submit
44+
--out manifests
45+
46+
# Add PowerShell dependency to installer manifest
47+
$installerManifest = Get-ChildItem -Path manifests -Filter "*.installer.yaml" -Recurse | Select-Object -First 1 -ExpandProperty FullName
48+
if (-not $installerManifest) {
49+
Write-Error "No installer manifest (*.installer.yaml) was found in the 'manifests' directory."
50+
exit 1
51+
}
52+
$content = Get-Content -Path $installerManifest -Raw
53+
$dependency = @"
54+
Dependencies:
55+
PackageDependencies:
56+
- PackageIdentifier: Microsoft.PowerShell
57+
MinimumVersion: "7.0.0"
58+
"@
59+
# Insert dependency block before the Installers section
60+
$content = $content -replace '(?m)^Installers:', "$dependency`nInstallers:"
61+
Set-Content -Path $installerManifest -Value $content
62+
63+
# Submit the modified manifest
64+
.\wingetcreate.exe submit manifests

0 commit comments

Comments
 (0)