diff --git a/.github/workflows/winget-bootstrap.yml b/.github/workflows/winget-bootstrap.yml new file mode 100644 index 00000000..540390b3 --- /dev/null +++ b/.github/workflows/winget-bootstrap.yml @@ -0,0 +1,82 @@ +name: WinGet bootstrap (one-off, delete after use) + +on: + push: + branches: ["ci/winget-bootstrap"] + +jobs: + bootstrap: + runs-on: windows-latest + steps: + - name: Generate manifests and submit to winget-pkgs + shell: pwsh + env: + WINGET_TOKEN: ${{ secrets.WINGET_SUBMIT_TOKEN }} + run: | + $ErrorActionPreference = "Stop" + $version = "0.30.0" + $pkgId = "PythoughtsLabs.PythinkerCode" + $installerUrl = "https://github.com/Pythoughts-labs/pythinker-code/releases/download/v$version/PythinkerSetup-$version.exe" + + $wcUrl = "https://github.com/microsoft/winget-create/releases/download/v1.12.8.0/wingetcreate.exe" + $wcSha = "8BD738851B524885410112678E3771B341C5C716DE60FBBECB88AB0A363ED85D" + Invoke-WebRequest -Uri $wcUrl -OutFile wingetcreate.exe + if ((Get-FileHash wingetcreate.exe -Algorithm SHA256).Hash -ne $wcSha) { throw "hash mismatch" } + + $sha256 = [System.Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri "$installerUrl.sha256").Content).Trim().Split()[0] + Write-Host "SHA256: $sha256" + + Invoke-WebRequest -Uri $installerUrl -OutFile installer.exe + $header = [System.Text.Encoding]::ASCII.GetString([System.IO.File]::ReadAllBytes("installer.exe")[0..65535]) + $installerType = if ($header -match "Inno Setup") { "inno" } elseif ($header -match "Nullsoft") { "nullsoft" } else { "exe" } + $silentSwitch = if ($installerType -eq "inno") { "/VERYSILENT /NORESTART" } else { "/S" } + Write-Host "Installer type: $installerType" + + $dir = "manifests\p\PythoughtsLabs\PythinkerCode\$version" + New-Item -ItemType Directory -Force -Path $dir | Out-Null + + @("PackageIdentifier: $pkgId", + "PackageVersion: $version", + "DefaultLocale: en-US", + "ManifestType: version", + "ManifestVersion: 1.6.0") -join "`n" | + Set-Content -Path "$dir\$pkgId.yaml" -Encoding UTF8 + + @("PackageIdentifier: $pkgId", + "PackageVersion: $version", + "Platform:", + "- Windows.Desktop", + "MinimumOSVersion: 10.0.17763.0", + "InstallerType: $installerType", + "Installers:", + "- Architecture: x64", + " InstallerUrl: $installerUrl", + " InstallerSha256: $sha256", + " InstallerSwitches:", + " Silent: $silentSwitch", + " SilentWithProgress: $silentSwitch", + "ManifestType: installer", + "ManifestVersion: 1.6.0") -join "`n" | + Set-Content -Path "$dir\$pkgId.installer.yaml" -Encoding UTF8 + + @("PackageIdentifier: $pkgId", + "PackageVersion: $version", + "PackageLocale: en-US", + "Publisher: Pythoughts Labs", + "PublisherUrl: https://pythinker.com", + "PackageName: Pythinker Code", + "PackageUrl: https://pythinker.com", + "License: Apache-2.0", + "LicenseUrl: https://github.com/Pythoughts-labs/pythinker-code/blob/main/LICENSE", + "ShortDescription: Terminal-native review-first AI engineering agent", + "Moniker: pythinker", + "Tags:", + "- ai", + "- agent", + "- cli", + "ManifestType: defaultLocale", + "ManifestVersion: 1.6.0") -join "`n" | + Set-Content -Path "$dir\$pkgId.locale.en-US.yaml" -Encoding UTF8 + + Write-Host "Generated:"; Get-ChildItem $dir + .\wingetcreate.exe submit $dir --token $env:WINGET_TOKEN