-
Notifications
You must be signed in to change notification settings - Fork 1
389 lines (338 loc) · 14 KB
/
Copy pathrelease-winget.yml
File metadata and controls
389 lines (338 loc) · 14 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
name: "Release: WinGet"
# Rechenaufwand-Score: R=3 (K=2, L=3, N=2) | last-calibrated: 2026-09-04
# Trigger policy: repo framework score calibration for workflow cost controls.
# Automated WinGet community package submission (after stable release).
#
# Trigger:
# - Runs after successful GitHub Release creation (release event)
# - Triggers only on stable releases (not pre-release)
# - Can be manually triggered with explicit version
#
# Pipeline stages:
# detect-release → download-artifacts → generate-checksums
# → generate-manifests → validate-manifests → create-fork-pr
# → notify
#
# Output:
# - WinGet manifest files (YAML)
# - Pull request to https://github.com/microsoft/winget-pkgs
# - Checksums and SBOM artifacts
on:
workflow_call:
inputs:
version:
description: "Version to submit to WinGet (e.g., 2.4.0)"
required: true
type: string
release-url:
description: "GitHub Release URL (for context)"
required: false
type: string
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Version to submit to WinGet (e.g., 2.4.0)"
required: true
type: string
release-url:
description: "GitHub Release URL (for context)"
required: false
type: string
permissions:
contents: read
packages: read
actions: read
pull-requests: write
jobs:
detect-release:
name: Detect Release Type
runs-on: ubuntu-latest
outputs:
version: ${{ steps.detect.outputs.version }}
release-type: ${{ steps.detect.outputs.release-type }}
is-stable: ${{ steps.detect.outputs.is-stable }}
should-submit: ${{ steps.detect.outputs.should-submit }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect release details
id: detect
run: |
set -euo pipefail
VERSION=""
RELEASE_TYPE=""
IS_STABLE="false"
SHOULD_SUBMIT="false"
if [[ "${{ github.event_name }}" == "workflow_call" ]]; then
# Reusable workflow trigger
VERSION="${{ inputs.version }}"
RELEASE_TYPE="stable"
IS_STABLE="true"
SHOULD_SUBMIT="true"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
# Manual trigger
VERSION="${{ github.event.inputs.version }}"
RELEASE_TYPE="stable"
IS_STABLE="true"
SHOULD_SUBMIT="true"
elif [[ "${{ github.event_name }}" == "release" ]]; then
# Triggered by release event
VERSION="${{ github.event.release.tag_name }}"
IS_PRERELEASE="${{ github.event.release.prerelease }}"
# Extract version from tag (v2.4.0 → 2.4.0)
VERSION="${VERSION#v}"
VERSION="${VERSION#enterprise-v}"
VERSION="${VERSION#hyperscaler-v}"
VERSION="${VERSION#military-v}"
VERSION="${VERSION#minimal-v}"
# Only submit stable (non-prerelease) releases for community WinGet
if [[ "$IS_PRERELEASE" == "false" ]]; then
RELEASE_TYPE="stable"
IS_STABLE="true"
SHOULD_SUBMIT="true"
else
echo "::notice::Skipping WinGet submission for prerelease: $VERSION"
fi
fi
{
echo "version=$VERSION"
echo "release-type=$RELEASE_TYPE"
echo "is-stable=$IS_STABLE"
echo "should-submit=$SHOULD_SUBMIT"
} >> "$GITHUB_OUTPUT"
echo "::notice::Release Detection:"
echo " Version: $VERSION"
echo " Is Stable: $IS_STABLE"
echo " Should Submit: $SHOULD_SUBMIT"
download-artifacts:
name: Download Release Artifacts
needs: detect-release
runs-on: ubuntu-latest
if: needs.detect-release.outputs.should-submit == 'true'
outputs:
artifact-dir: ${{ steps.download.outputs.artifact-dir }}
steps:
- name: Download release assets
id: download
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
TAG="v${{ needs.detect-release.outputs.version }}"
mkdir -p release-artifacts
gh release download "$TAG" --repo "${{ github.repository }}" --dir release-artifacts --clobber
if [[ -z "$(find release-artifacts -type f -print -quit)" ]]; then
echo "::error::No release assets downloaded for tag $TAG"
exit 1
fi
echo "artifact-dir=release-artifacts" >> "$GITHUB_OUTPUT"
- name: List downloaded artifacts
run: |
echo "Downloaded artifacts:"
find release-artifacts -type f | head -20
generate-checksums:
name: Generate Checksums for Windows Binaries
needs: [detect-release, download-artifacts]
runs-on: ubuntu-latest
if: needs.detect-release.outputs.should-submit == 'true'
outputs:
checksums-json: ${{ steps.checksums.outputs.checksums-json }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate checksums
id: checksums
shell: pwsh
run: |
.github/scripts/generate-winget-checksums.ps1 `
-ArtifactDir "${{ needs.download-artifacts.outputs.artifact-dir }}" `
-OutputDir "${{ runner.temp }}/checksums" `
-IncludeSBOM
- name: Upload checksums
uses: actions/upload-artifact@v4
with:
name: winget-checksums
path: ${{ runner.temp }}/checksums/checksums.json
retention-days: 90
generate-manifests:
name: Generate WinGet Manifests
needs: [detect-release, generate-checksums]
runs-on: ubuntu-latest
if: needs.detect-release.outputs.should-submit == 'true'
outputs:
manifest-dir: ${{ steps.generate.outputs.manifest-dir }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download checksums
uses: actions/download-artifact@v4
with:
name: winget-checksums
- name: Generate WinGet manifests
id: generate
shell: pwsh
run: |
$Version = "${{ needs.detect-release.outputs.version }}"
$ManifestDir = "packaging/winget/manifests/t/ThemisDB/ThemisDB/$Version"
# Create manifest directory
New-Item -ItemType Directory -Path $ManifestDir -Force | Out-Null
# Read checksums
$Checksums = Get-Content checksums.json | ConvertFrom-Json
# Find Windows installers in artifacts
$Zip64 = $Checksums.artifacts | Where-Object { $_.filename -match "windows.*x64.*\.zip" } | Select-Object -First 1
$Zip86 = $Checksums.artifacts | Where-Object { $_.filename -match "windows.*x86.*\.zip" } | Select-Object -First 1
if (-not $Zip64) {
Write-Error "No x64 Windows ZIP artifact found"
exit 1
}
# Build download URLs
$DownloadUrl64 = "https://github.com/${{ github.repository }}/releases/download/v${Version}/$($Zip64.filename)"
$DownloadUrl86 = if ($Zip86) { "https://github.com/${{ github.repository }}/releases/download/v${Version}/$($Zip86.filename)" } else { "" }
# Generate root manifest (ThemisDB.ThemisDB.yaml)
$RootManifest = @"
PackageIdentifier: ThemisDB.ThemisDB
PackageVersion: $Version
PackageLocale: en-US
PackageName: ThemisDB
PackagePublisher: ThemisDB Contributors
PackageUrl: https://github.com/makr-code/ThemisDB
License: Apache-2.0
LicenseUrl: https://github.com/makr-code/ThemisDB/blob/develop/LICENSE
ShortDescription: Distributed knowledge graph database
Description: |
ThemisDB is a distributed, high-performance knowledge graph database
with built-in LLM integration and advanced graph algorithms.
Moniker: themisdb
Tags:
- database
- knowledge-graph
- distributed
- graph
- llm
"@
$RootManifest | Set-Content -Path "$ManifestDir/ThemisDB.ThemisDB.yaml" -Encoding UTF8
# Generate installer manifest
$InstallerManifest = @"
PackageIdentifier: ThemisDB.ThemisDB
PackageVersion: $Version
Platform:
- Windows.Desktop
MinimumOSVersion: '10.0.14393.0'
Scope: Machine
Installers:
"@
# x64 installer entry
$InstallerManifest += @"
- Architecture: x64
InstallerType: zip
InstallerUrl: $DownloadUrl64
InstallerSha256: $($Zip64.sha256)
ReleaseNotes: |
Build: #${{ github.run_number }} ($(Get-Date -Format 'yyyy-MM-dd'))
Release Type: stable
Commit: $(git rev-parse --short HEAD)
"@
# x86 installer entry (if available)
if ($Zip86) {
$InstallerManifest += @"
- Architecture: x86
InstallerType: zip
InstallerUrl: $DownloadUrl86
InstallerSha256: $($Zip86.sha256)
ReleaseNotes: |
Build: #${{ github.run_number }} ($(Get-Date -Format 'yyyy-MM-dd'))
Release Type: stable
Commit: $(git rev-parse --short HEAD)
"@
}
$InstallerManifest | Set-Content -Path "$ManifestDir/ThemisDB.ThemisDB.installer.yaml" -Encoding UTF8
# Generate locale manifest (en-US)
$LocaleManifest = @"
PackageIdentifier: ThemisDB.ThemisDB
PackageVersion: $Version
PackageLocale: en-US
LicenseUrl: https://github.com/makr-code/ThemisDB/blob/develop/LICENSE
ReleaseNotesUrl: https://github.com/makr-code/ThemisDB/releases/tag/v${Version}
"@
$LocaleManifest | Set-Content -Path "$ManifestDir/ThemisDB.ThemisDB.locale.en-US.yaml" -Encoding UTF8
Write-Host "✓ Generated manifests in: $ManifestDir"
echo "manifest-dir=$ManifestDir" >> $env:GITHUB_OUTPUT
validate-manifests:
name: Validate WinGet Manifests
needs: generate-manifests
runs-on: windows-latest
if: needs.generate-manifests.outputs.manifest-dir != ''
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Validate manifests with winget
shell: pwsh
run: |
$ManifestDir = "${{ needs.generate-manifests.outputs.manifest-dir }}"
Write-Host "Validating manifest directory: $ManifestDir"
# winget validate requires the manifest root path
winget validate --manifest "$ManifestDir"
if ($LASTEXITCODE -ne 0) {
Write-Error "Manifest validation failed"
exit $LASTEXITCODE
}
Write-Host "✓ Manifests are valid"
create-fork-pr:
name: Create PR to WinGet Community Repository
needs: [detect-release, validate-manifests, generate-manifests]
runs-on: ubuntu-latest
if: |
needs.generate-manifests.outputs.manifest-dir != '' &&
github.event_name != 'workflow_dispatch'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Git for fork submission
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Create fork PR (manual workflow for WinGet submission)
run: |
set -euo pipefail
VERSION="${{ needs.detect-release.outputs.version }}"
MANIFEST_DIR="${{ needs.generate-manifests.outputs.manifest-dir }}"
echo "::notice::Generated WinGet manifests for version $VERSION"
echo "::notice::Manifests located at: $MANIFEST_DIR"
echo "::notice::To submit to WinGet:"
echo " 1. Fork: https://github.com/microsoft/winget-pkgs"
echo " 2. Copy $MANIFEST_DIR to your fork"
echo " 3. Submit PR to microsoft/winget-pkgs"
echo ""
echo "Manifest files:"
ls -lh "$MANIFEST_DIR"
- name: Upload manifests as artifact
uses: actions/upload-artifact@v4
with:
name: winget-manifests-${{ needs.detect-release.outputs.version }}
path: ${{ needs.generate-manifests.outputs.manifest-dir }}
retention-days: 90
notify:
name: Notify WinGet Submission
needs: [detect-release, generate-manifests]
runs-on: ubuntu-latest
if: always()
steps:
- name: Report WinGet submission status
run: |
echo "═══════════════════════════════════════════════════"
echo "WinGet Release Submission Status"
echo "═══════════════════════════════════════════════════"
echo "Version: ${{ needs.detect-release.outputs.version }}"
echo "Should Submit: ${{ needs.detect-release.outputs.should-submit }}"
echo "Manifests Generated: ${{ needs.generate-manifests.outputs.manifest-dir }}"
echo ""
echo "Next steps:"
echo " 1. Download winget-manifests artifact"
echo " 2. Fork: https://github.com/microsoft/winget-pkgs"
echo " 3. Copy manifests to your fork at:"
echo " manifests/t/ThemisDB/ThemisDB/${{ needs.detect-release.outputs.version }}/"
echo " 4. Submit PR with title:"
echo " 'New package: ThemisDB.ThemisDB version ${{ needs.detect-release.outputs.version }}'"
echo "═══════════════════════════════════════════════════"