Skip to content

Commit 95d8377

Browse files
committed
ci: use wingetcreate submit with generated manifests instead of interactive new
1 parent 4b1c8f9 commit 95d8377

1 file changed

Lines changed: 90 additions & 10 deletions

File tree

‎.github/workflows/winget-bootstrap.yml‎

Lines changed: 90 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,99 @@ jobs:
88
bootstrap:
99
runs-on: windows-latest
1010
steps:
11-
- name: Run wingetcreate new
11+
- name: Generate manifests and submit to winget-pkgs
1212
shell: pwsh
1313
env:
1414
WINGET_TOKEN: ${{ secrets.WINGET_SUBMIT_TOKEN }}
1515
run: |
1616
$ErrorActionPreference = "Stop"
17-
$installerUrl = "https://github.com/Pythoughts-labs/pythinker-code/releases/download/v0.30.0/PythinkerSetup-0.30.0.exe"
18-
$wingetCreateUrl = "https://github.com/microsoft/winget-create/releases/download/v1.12.8.0/wingetcreate.exe"
19-
$wingetCreateSha256 = "8BD738851B524885410112678E3771B341C5C716DE60FBBECB88AB0A363ED85D"
20-
Invoke-WebRequest -Uri $wingetCreateUrl -OutFile wingetcreate.exe
21-
$actualHash = (Get-FileHash -Algorithm SHA256 wingetcreate.exe).Hash
22-
if ($actualHash -ne $wingetCreateSha256) {
23-
throw "wingetcreate.exe SHA-256 mismatch: expected $wingetCreateSha256, got $actualHash"
17+
$version = "0.30.0"
18+
$pkgId = "PythoughtsLabs.PythinkerCode"
19+
$installerUrl = "https://github.com/Pythoughts-labs/pythinker-code/releases/download/v$version/PythinkerSetup-$version.exe"
20+
21+
# Download wingetcreate (pinned SHA)
22+
$wcUrl = "https://github.com/microsoft/winget-create/releases/download/v1.12.8.0/wingetcreate.exe"
23+
$wcSha = "8BD738851B524885410112678E3771B341C5C716DE60FBBECB88AB0A363ED85D"
24+
Invoke-WebRequest -Uri $wcUrl -OutFile wingetcreate.exe
25+
if ((Get-FileHash wingetcreate.exe -Algorithm SHA256).Hash -ne $wcSha) {
26+
throw "wingetcreate.exe hash mismatch"
2427
}
25-
# --token triggers auto-submit to winget-pkgs; --no-open suppresses browser
26-
.\wingetcreate.exe new "$installerUrl" --token $env:WINGET_TOKEN --no-open
28+
29+
# Get installer SHA256 from release sidecar
30+
$sha256 = ((Invoke-WebRequest -Uri "$installerUrl.sha256").Content.Trim() -split '\s+')[0]
31+
Write-Host "Installer SHA256: $sha256"
32+
33+
# Detect installer type by inspecting the binary header
34+
Invoke-WebRequest -Uri $installerUrl -OutFile installer.exe
35+
$bytes = [System.IO.File]::ReadAllBytes("installer.exe")
36+
$header = [System.Text.Encoding]::ASCII.GetString($bytes[0..65535])
37+
if ($header -match "Inno Setup") {
38+
$installerType = "inno"
39+
} elseif ($header -match "Nullsoft") {
40+
$installerType = "nullsoft"
41+
} else {
42+
$installerType = "exe"
43+
}
44+
Write-Host "Detected installer type: $installerType"
45+
46+
# Build manifest directory
47+
$dir = "manifests\p\PythoughtsLabs\PythinkerCode\$version"
48+
New-Item -ItemType Directory -Force -Path $dir | Out-Null
49+
50+
# version manifest
51+
@"
52+
PackageIdentifier: $pkgId
53+
PackageVersion: $version
54+
DefaultLocale: en-US
55+
ManifestType: version
56+
ManifestVersion: 1.6.0
57+
"@ | Set-Content "$dir\$pkgId.yaml" -Encoding UTF8
58+
59+
# installer manifest
60+
$silentSwitch = if ($installerType -eq "inno") { "/VERYSILENT /NORESTART" }
61+
elseif ($installerType -eq "nullsoft") { "/S" }
62+
else { "/S" }
63+
@"
64+
PackageIdentifier: $pkgId
65+
PackageVersion: $version
66+
Platform:
67+
- Windows.Desktop
68+
MinimumOSVersion: 10.0.17763.0
69+
InstallerType: $installerType
70+
Installers:
71+
- Architecture: x64
72+
InstallerUrl: $installerUrl
73+
InstallerSha256: $sha256
74+
InstallerSwitches:
75+
Silent: $silentSwitch
76+
SilentWithProgress: $silentSwitch
77+
ManifestType: installer
78+
ManifestVersion: 1.6.0
79+
"@ | Set-Content "$dir\$pkgId.installer.yaml" -Encoding UTF8
80+
81+
# locale manifest
82+
@"
83+
PackageIdentifier: $pkgId
84+
PackageVersion: $version
85+
PackageLocale: en-US
86+
Publisher: Pythoughts Labs
87+
PublisherUrl: https://pythinker.com
88+
PackageName: Pythinker Code
89+
PackageUrl: https://pythinker.com
90+
License: Apache-2.0
91+
LicenseUrl: https://github.com/Pythoughts-labs/pythinker-code/blob/main/LICENSE
92+
ShortDescription: Terminal-native review-first AI engineering agent
93+
Moniker: pythinker
94+
Tags:
95+
- ai
96+
- agent
97+
- cli
98+
ManifestType: defaultLocale
99+
ManifestVersion: 1.6.0
100+
"@ | Set-Content "$dir\$pkgId.locale.en-US.yaml" -Encoding UTF8
101+
102+
Write-Host "Manifest files generated:"
103+
Get-ChildItem $dir
104+
105+
# Submit via wingetcreate submit (non-interactive)
106+
.\wingetcreate.exe submit $dir --token $env:WINGET_TOKEN

0 commit comments

Comments
 (0)