-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (135 loc) · 5.36 KB
/
Copy pathwinget.yml
File metadata and controls
153 lines (135 loc) · 5.36 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
name: Winget Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v0.1.0)'
required: true
env:
PACKAGE_ID: CortexLM.Cortex
jobs:
# Lightweight job - 4 vCPU Blacksmith Windows runner
winget:
name: Publish to Winget
runs-on: blacksmith-4vcpu-windows-2025
steps:
- uses: actions/checkout@v7
- name: Get version
id: version
shell: pwsh
run: |
if ("${{ github.event_name }}" -eq "workflow_dispatch") {
$version = "${{ github.event.inputs.tag }}" -replace '^v', ''
} else {
$version = "${{ github.event.release.tag_name }}" -replace '^v', ''
}
echo "version=$version" >> $env:GITHUB_OUTPUT
echo "Version: $version"
- name: Get release URLs and hashes
id: release
shell: pwsh
run: |
$tag = "v${{ steps.version.outputs.version }}"
$baseUrl = "https://github.com/${{ github.repository }}/releases/download/$tag"
# Download and hash x64
$x64Url = "$baseUrl/cortex-cli-windows-x64.zip"
Invoke-WebRequest -Uri $x64Url -OutFile "cortex-x64.zip" -ErrorAction Stop
$x64Hash = (Get-FileHash -Path "cortex-x64.zip" -Algorithm SHA256).Hash
# ARM64 is intentionally absent from the release matrix.
echo "x64_url=$x64Url" >> $env:GITHUB_OUTPUT
echo "x64_hash=$x64Hash" >> $env:GITHUB_OUTPUT
- name: Create winget manifest directory
shell: pwsh
run: |
$version = "${{ steps.version.outputs.version }}"
$manifestDir = "manifests/c/CortexLM/Cortex/$version"
New-Item -ItemType Directory -Force -Path $manifestDir
echo "MANIFEST_DIR=$manifestDir" >> $env:GITHUB_ENV
- name: Generate version manifest
shell: pwsh
run: |
$content = @"
PackageIdentifier: ${{ env.PACKAGE_ID }}
PackageVersion: ${{ steps.version.outputs.version }}
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.6.0
"@
$content | Out-File -FilePath "${{ env.MANIFEST_DIR }}/${{ env.PACKAGE_ID }}.yaml" -Encoding utf8
- name: Generate installer manifest
shell: pwsh
run: |
$installers = @"
PackageIdentifier: ${{ env.PACKAGE_ID }}
PackageVersion: ${{ steps.version.outputs.version }}
Platform:
- Windows.Desktop
MinimumOSVersion: 10.0.17763.0
InstallerType: zip
NestedInstallerType: portable
NestedInstallerFiles:
- RelativeFilePath: Cortex.exe
PortableCommandAlias: cortex
Installers:
- Architecture: x64
InstallerUrl: ${{ steps.release.outputs.x64_url }}
InstallerSha256: ${{ steps.release.outputs.x64_hash }}
"@
$installers += @"
ManifestType: installer
ManifestVersion: 1.6.0
"@
$installers | Out-File -FilePath "${{ env.MANIFEST_DIR }}/${{ env.PACKAGE_ID }}.installer.yaml" -Encoding utf8
- name: Generate locale manifest
shell: pwsh
run: |
$content = @"
PackageIdentifier: ${{ env.PACKAGE_ID }}
PackageVersion: ${{ steps.version.outputs.version }}
PackageLocale: en-US
Publisher: CortexLM
PublisherUrl: https://github.com/CortexLM
PublisherSupportUrl: https://github.com/CortexLM/cli/issues
PackageName: Cortex CLI
PackageUrl: https://github.com/CortexLM/cli
License: Apache-2.0
LicenseUrl: https://github.com/CortexLM/cli/blob/main/LICENSE
ShortDescription: Cortex CLI - A modern AI coding agent
Description: Cortex is a powerful command-line AI coding assistant that helps developers write, debug, and maintain code more efficiently.
Tags:
- ai
- cli
- coding
- developer-tools
- rust
ManifestType: defaultLocale
ManifestVersion: 1.6.0
"@
$content | Out-File -FilePath "${{ env.MANIFEST_DIR }}/${{ env.PACKAGE_ID }}.locale.en-US.yaml" -Encoding utf8
- name: Require provisioned package tooling
shell: pwsh
run: |
# Do not execute an unpinned executable downloaded at publish time.
# The Windows runner image must provision the reviewed tooling.
$tool = Get-Command wingetcreate.exe -CommandType Application -ErrorAction Stop
$signature = Get-AuthenticodeSignature -FilePath $tool.Source
if ($signature.Status -ne 'Valid' -or $signature.SignerCertificate.Subject -notmatch 'O=Microsoft Corporation') {
throw 'wingetcreate must have a valid Microsoft signature'
}
- name: Validate manifests
shell: pwsh
run: |
wingetcreate.exe validate ${{ env.MANIFEST_DIR }}
- name: Submit to winget-pkgs
shell: pwsh
run: |
wingetcreate.exe submit ${{ env.MANIFEST_DIR }} --token $env:WINGET_PAT
env:
WINGET_PAT: ${{ secrets.WINGET_PAT }}
- name: Upload manifests as artifact
uses: actions/upload-artifact@v7
with:
name: winget-manifests
path: manifests/