Skip to content

Commit 8d7e467

Browse files
Add PowerShell dependency to winget manifests
Modify the winget workflow to inject a PowerShell >= 7.0.0 dependency into the installer manifest before submission. This ensures users have PowerShell 7+ installed when installing via winget. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e0ec58f commit 8d7e467

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

.github/workflows/winget.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,20 @@ 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
48+
$content = Get-Content $installerManifest -Raw
49+
$dependency = @"
50+
Dependencies:
51+
PackageDependencies:
52+
- PackageIdentifier: Microsoft.PowerShell
53+
MinimumVersion: "7.0.0"
54+
"@
55+
# Insert dependency block before the Installers section
56+
$content = $content -replace '(?m)^Installers:', "$dependency`nInstallers:"
57+
Set-Content -Path $installerManifest -Value $content -NoNewline
58+
59+
# Submit the modified manifest
60+
.\wingetcreate.exe submit manifests

0 commit comments

Comments
 (0)