@@ -875,31 +875,90 @@ jobs:
875875 $tag = "${{ needs.determine-version.outputs.tag_name }}"
876876 $base = "https://github.com/wendylabsinc/wendy-agent/releases/download/$tag"
877877 $token = "${{ secrets.WINGET_GITHUB_TOKEN }}"
878- $amd64 = "$base/wendy-cli-windows-amd64-$version.msi"
879- $arm64 = "$base/wendy-cli-windows-arm64-$version.msi"
878+ $amd64Url = "$base/wendy-cli-windows-amd64-$version.msi"
879+ $arm64Url = "$base/wendy-cli-windows-arm64-$version.msi"
880880
881- # Try update first; if the package doesn't exist yet, fall back to new
881+ # Try update first (works once the package exists in winget-pkgs)
882882 .\wingetcreate.exe update WendyLabs.Wendy `
883883 --version $version `
884- --urls $amd64 $arm64 `
884+ --urls $amd64Url $arm64Url `
885885 --submit `
886886 --token $token
887- if ($LASTEXITCODE -ne 0) {
888- Write-Host "Update failed, attempting initial submission with 'new'..."
889- .\wingetcreate.exe new $amd64 $arm64 `
890- --version $version `
891- --id WendyLabs.Wendy `
892- --name Wendy `
893- --publisher "Wendy Labs" `
894- --submit `
895- --token $token
896- if ($LASTEXITCODE -ne 0) {
897- Write-Error "Winget package submission failed (update and new both failed) with exit code $LASTEXITCODE."
898- exit $LASTEXITCODE
899- }
887+ if ($LASTEXITCODE -eq 0) {
888+ Write-Host "Winget package updated successfully."
889+ exit 0
900890 }
901891
892+ Write-Host "Update failed (package may not exist yet). Generating initial manifest..."
893+
894+ # Download installers to compute SHA256 hashes
895+ Invoke-WebRequest -Uri $amd64Url -OutFile amd64.msi
896+ Invoke-WebRequest -Uri $arm64Url -OutFile arm64.msi
897+ $amd64Hash = (Get-FileHash -Algorithm SHA256 amd64.msi).Hash
898+ $arm64Hash = (Get-FileHash -Algorithm SHA256 arm64.msi).Hash
899+
900+ # Generate the three manifest YAML files required by winget-pkgs
901+ $manifestDir = "manifests\w\WendyLabs\Wendy\$version"
902+ New-Item -ItemType Directory -Path $manifestDir -Force | Out-Null
903+
904+ @"
905+ # yaml-language-server: `$schema=https://aka.ms/winget-manifest.version.1.9.0.schema.json
906+ PackageIdentifier: WendyLabs.Wendy
907+ PackageVersion: $version
908+ DefaultLocale: en-US
909+ ManifestType: version
910+ ManifestVersion: 1.9.0
911+ "@ -replace '(?m)^ ', '' | Set-Content "$manifestDir\WendyLabs.Wendy.yaml" -Encoding utf8
912+
913+ @"
914+ # yaml-language-server: `$schema=https://aka.ms/winget-manifest.installer.1.9.0.schema.json
915+ PackageIdentifier: WendyLabs.Wendy
916+ PackageVersion: $version
917+ Platform:
918+ - Windows.Desktop
919+ MinimumOSVersion: 10.0.17763.0
920+ InstallerType: msi
921+ UpgradeBehavior: install
922+ ReleaseDate: $(Get-Date -Format 'yyyy-MM-dd')
923+ Installers:
924+ - Architecture: x64
925+ InstallerUrl: $amd64Url
926+ InstallerSha256: $amd64Hash
927+ - Architecture: arm64
928+ InstallerUrl: $arm64Url
929+ InstallerSha256: $arm64Hash
930+ ManifestType: installer
931+ ManifestVersion: 1.9.0
932+ "@ -replace '(?m)^ ', '' | Set-Content "$manifestDir\WendyLabs.Wendy.installer.yaml" -Encoding utf8
933+
934+ @"
935+ # yaml-language-server: `$schema=https://aka.ms/winget-manifest.defaultLocale.1.9.0.schema.json
936+ PackageIdentifier: WendyLabs.Wendy
937+ PackageVersion: $version
938+ PackageLocale: en-US
939+ Publisher: Wendy Labs
940+ PublisherUrl: https://github.com/wendylabsinc
941+ PublisherSupportUrl: https://github.com/wendylabsinc/wendy-agent/issues
942+ PackageName: Wendy
943+ PackageUrl: https://github.com/wendylabsinc/wendy-agent
944+ License: Proprietary
945+ ShortDescription: CLI for building and deploying apps to WendyOS edge devices.
946+ Tags:
947+ - cli
948+ - edge-computing
949+ - iot
950+ - developer-tools
951+ ManifestType: defaultLocale
952+ ManifestVersion: 1.9.0
953+ "@ -replace '(?m)^ ', '' | Set-Content "$manifestDir\WendyLabs.Wendy.locale.en-US.yaml" -Encoding utf8
954+
955+ # Submit the generated manifest
956+ .\wingetcreate.exe submit `
957+ --prtitle "New package: WendyLabs.Wendy version $version" `
958+ --token $token `
959+ $manifestDir
902960 if ($LASTEXITCODE -ne 0) {
903- Write-Error "Winget package publication failed with exit code $LASTEXITCODE."
961+ Write-Error "Winget manifest submission failed with exit code $LASTEXITCODE."
904962 exit $LASTEXITCODE
905963 }
964+ Write-Host "Initial Winget manifest submitted successfully."
0 commit comments