-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (103 loc) · 4.5 KB
/
Copy pathwinget-init.yml
File metadata and controls
116 lines (103 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: Initial WinGet Submission
on:
workflow_dispatch:
inputs:
version:
description: "Version to submit, without v prefix"
required: true
type: string
permissions:
contents: read
jobs:
submit-to-winget:
runs-on: windows-latest
steps:
- name: Resolve release asset
id: release
shell: pwsh
run: |
$version = "${{ inputs.version }}"
$tag = "v$version"
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/${{ github.repository }}/releases/tags/$tag" -Headers @{
"Accept" = "application/vnd.github+json"
"X-GitHub-Api-Version" = "2022-11-28"
}
$exe = $release.assets | Where-Object { $_.name -match "agent-mail-$version-windows-x64\.exe$" }
if ($null -eq $exe) {
Write-Error "Windows x64 executable not found for $tag"
exit 1
}
Write-Output "installer_url=$($exe.browser_download_url)" >> $env:GITHUB_OUTPUT
- name: Download WinGet Create
shell: pwsh
run: Invoke-WebRequest -Uri https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
- name: Create WinGet manifest and submit PR
shell: pwsh
env:
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
run: |
$packageId = "JuanjoFuchs.agent-mail-cli"
$version = "${{ inputs.version }}"
$url = "${{ steps.release.outputs.installer_url }}"
$manifestVersion = "1.12.0"
$manifestDir = Join-Path "manifests" "j/JuanjoFuchs/agent-mail-cli/$version"
New-Item -ItemType Directory -Path $manifestDir -Force | Out-Null
Invoke-WebRequest -Uri $url -OutFile agent-mail.exe
$sha256 = (Get-FileHash -Algorithm SHA256 agent-mail.exe).Hash
@(
"# yaml-language-server: `$schema=https://aka.ms/winget-manifest.version.$manifestVersion.schema.json",
"PackageIdentifier: $packageId",
"PackageVersion: $version",
"DefaultLocale: en-US",
"ManifestType: version",
"ManifestVersion: $manifestVersion"
) | Set-Content (Join-Path $manifestDir "$packageId.yaml")
@(
"# yaml-language-server: `$schema=https://aka.ms/winget-manifest.defaultLocale.$manifestVersion.schema.json",
"PackageIdentifier: $packageId",
"PackageVersion: $version",
"PackageLocale: en-US",
"Publisher: JuanjoFuchs",
"PublisherUrl: https://github.com/JuanjoFuchs",
"PackageName: Agent Mail CLI",
"PackageUrl: https://github.com/JuanjoFuchs/agent-mail-cli",
"License: MIT",
"LicenseUrl: https://github.com/JuanjoFuchs/agent-mail-cli/blob/main/LICENSE",
"ShortDescription: Self-describing local inbox for coding agents",
"Description: Agent Mail CLI is a local SQLite-backed inbox for coding agents.",
"Moniker: agent-mail",
"Tags:",
"- agents",
"- cli",
"- mailbox",
"ManifestType: defaultLocale",
"ManifestVersion: $manifestVersion"
) | Set-Content (Join-Path $manifestDir "$packageId.locale.en-US.yaml")
@(
"# yaml-language-server: `$schema=https://aka.ms/winget-manifest.installer.$manifestVersion.schema.json",
"PackageIdentifier: $packageId",
"PackageVersion: $version",
"InstallerType: portable",
"Commands:",
"- agent-mail",
"UpgradeBehavior: uninstallPrevious",
"Installers:",
"- Architecture: x64",
" InstallerUrl: $url",
" InstallerSha256: $sha256",
"ManifestType: installer",
"ManifestVersion: $manifestVersion"
) | Set-Content (Join-Path $manifestDir "$packageId.installer.yaml")
Get-ChildItem -Path $manifestDir -Filter "*.yaml" | ForEach-Object {
Write-Host "Generated $($_.FullName)"
Get-Content $_.FullName
}
if (-not (Select-String -Path (Join-Path $manifestDir "$packageId.installer.yaml") -Pattern "UpgradeBehavior: uninstallPrevious" -Quiet)) {
Write-Error "UpgradeBehavior validation failed"
exit 1
}
.\wingetcreate.exe submit $manifestDir --token $env:WINGET_TOKEN
if ($LASTEXITCODE -ne 0) {
Write-Error "wingetcreate failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}