Skip to content

Commit 37fba28

Browse files
templates and build step for validating/submitting winget package (#6485)
1 parent 4ba562d commit 37fba28

File tree

6 files changed

+149
-1
lines changed

6 files changed

+149
-1
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Winget Submit
2+
description: Template + validate + submission of WinGet manifests for Codex
3+
inputs:
4+
version:
5+
description: Release version (e.g., 0.58.0)
6+
required: true
7+
windows_x64_sha256:
8+
description: Windows x64 SHA256 for codex-x86_64-pc-windows-msvc.exe
9+
required: true
10+
windows_arm64_sha256:
11+
description: Windows arm64 SHA256 for codex-aarch64-pc-windows-msvc.exe
12+
required: true
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Build manifest directory
17+
shell: bash
18+
continue-on-error: true
19+
run: |
20+
set -euo pipefail
21+
# Mirror the winget-pkgs repo layout so validation matches what
22+
# we will submit:
23+
# manifests/<first-letter-lowercase>/<Publisher>/<PackageName>/<Version>/
24+
# For OpenAI.Codex vX.Y.Z → manifests/o/OpenAI/Codex/X.Y.Z
25+
VERSION="${{ inputs.version }}"
26+
X64_SHA="${{ inputs.windows_x64_sha256 }}"
27+
ARM_SHA="${{ inputs.windows_arm64_sha256 }}"
28+
root="manifests/o/OpenAI/Codex/$VERSION"
29+
tpl=".github/winget_templates"
30+
mkdir -p "$root"
31+
for f in OpenAI.Codex.yaml OpenAI.Codex.locale.en-US.yaml OpenAI.Codex.installer.yaml; do
32+
sed -e "s/{{VERSION}}/$VERSION/g" \
33+
-e "s/{{X64_SHA256}}/$X64_SHA/g" \
34+
-e "s/{{ARM64_SHA256}}/$ARM_SHA/g" \
35+
"$tpl/$f" > "$root/$f"
36+
done
37+
echo "Manifest staged at $root"
38+
39+
- name: Install WinGet Create
40+
shell: bash
41+
continue-on-error: true
42+
run: winget install --id Microsoft.WingetCreate -e --accept-package-agreements --accept-source-agreements
43+
44+
- name: Validate manifests
45+
shell: bash
46+
continue-on-error: true
47+
run: winget validate "manifests/o/OpenAI/Codex/${{ inputs.version }}"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
PackageIdentifier: OpenAI.Codex
2+
PackageVersion: {{VERSION}}
3+
Installers:
4+
- Architecture: x64
5+
InstallerType: portable
6+
InstallerUrl: https://github.com/openai/codex/releases/download/rust-v{{VERSION}}/codex-x86_64-pc-windows-msvc.exe
7+
InstallerSha256: {{X64_SHA256}}
8+
Commands:
9+
- codex
10+
- Architecture: arm64
11+
InstallerType: portable
12+
InstallerUrl: https://github.com/openai/codex/releases/download/rust-v{{VERSION}}/codex-aarch64-pc-windows-msvc.exe
13+
InstallerSha256: {{ARM64_SHA256}}
14+
Commands:
15+
- codex
16+
ManifestType: installer
17+
ManifestVersion: 1.5.0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
PackageIdentifier: OpenAI.Codex
2+
PackageVersion: {{VERSION}}
3+
PackageLocale: en-US
4+
Publisher: OpenAI
5+
PublisherUrl: https://github.com/openai
6+
PublisherSupportUrl: https://github.com/openai/codex/issues
7+
PrivacyUrl: https://openai.com/policies/privacy-policy
8+
PackageName: Codex
9+
PackageUrl: https://github.com/openai/codex
10+
License: Proprietary
11+
ShortDescription: Native Codex CLI (Rust) for terminal and TUI workflows.
12+
Moniker: codex
13+
Tags:
14+
- codex
15+
- cli
16+
- ai
17+
- agent
18+
ManifestType: defaultLocale
19+
ManifestVersion: 1.5.0
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
PackageIdentifier: OpenAI.Codex
2+
PackageVersion: {{VERSION}}
3+
DefaultLocale: en-US
4+
ManifestType: version
5+
ManifestVersion: 1.5.0

.github/workflows/rust-release.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ jobs:
383383
tag: ${{ github.ref_name }}
384384
should_publish_npm: ${{ steps.npm_publish_settings.outputs.should_publish }}
385385
npm_tag: ${{ steps.npm_publish_settings.outputs.npm_tag }}
386+
windows_x64_sha256: ${{ steps.win_hash.outputs.windows_x64_sha256 }}
387+
windows_arm64_sha256: ${{ steps.win_hash.outputs.windows_arm64_sha256 }}
386388

387389
steps:
388390
- name: Checkout repository
@@ -395,6 +397,16 @@ jobs:
395397
- name: List
396398
run: ls -R dist/
397399

400+
- name: Compute SHA256 for Windows EXEs
401+
id: win_hash
402+
shell: bash
403+
run: |
404+
set -euo pipefail
405+
x64_sha=$(sha256sum "dist/x86_64-pc-windows-msvc/codex-rs/dist/x86_64-pc-windows-msvc/codex-x86_64-pc-windows-msvc.exe" | awk '{print $1}')
406+
arm_sha=$(sha256sum "dist/aarch64-pc-windows-msvc/codex-rs/dist/aarch64-pc-windows-msvc/codex-aarch64-pc-windows-msvc.exe" | awk '{print $1}')
407+
echo "windows_x64_sha256=${x64_sha}" >> "$GITHUB_OUTPUT"
408+
echo "windows_arm64_sha256=${arm_sha}" >> "$GITHUB_OUTPUT"
409+
398410
- name: Define release name
399411
id: release_name
400412
run: |
@@ -549,4 +561,16 @@ jobs:
549561
repos/${GITHUB_REPOSITORY}/git/refs/heads/latest-alpha-cli \
550562
-X PATCH \
551563
-f sha="${GITHUB_SHA}" \
552-
-F force=true
564+
-F force=true
565+
566+
winget:
567+
needs: release
568+
runs-on: windows-latest
569+
steps:
570+
- uses: actions/checkout@v5
571+
- name: Validate WinGet manifests
572+
uses: ./.github/actions/winget-submit
573+
with:
574+
version: ${{ needs.release.outputs.version }}
575+
windows_x64_sha256: ${{ needs.release.outputs.windows_x64_sha256 }}
576+
windows_arm64_sha256: ${{ needs.release.outputs.windows_arm64_sha256 }}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
WinGet manifests for the Codex CLI
2+
3+
Local testing
4+
5+
- Validate: `winget validate .\manifests\o\OpenAI\Codex\0.57.0`
6+
- Install from local manifests: `winget install --manifest .\manifests\o\OpenAI\Codex\0.57.0`
7+
- Verify: `codex --version` and `where codex`
8+
- Uninstall: `winget uninstall OpenAI.Codex`
9+
10+
Submitting to winget-pkgs
11+
12+
- Ensure URLs and SHA256 match the public GitHub Release for this version.
13+
- Submit with `wingetcreate submit <path>` or copy this tree into a fork of `microsoft/winget-pkgs` under the same path.
14+
Winget manifests
15+
16+
- Templates live under `.github/winget_templates/` and use placeholders:
17+
- `{{VERSION}}`, `{{X64_SHA256}}`, `{{ARM64_SHA256}}`
18+
- The CI calls a composite action (`.github/actions/winget-submit`) from the release job:
19+
- Fills the templates using the release version and precomputed SHA256s,
20+
- Validates the manifests with `winget validate` (submission is separate).
21+
22+
Setup
23+
24+
- Ensure releases include raw Windows assets:
25+
- `codex-x86_64-pc-windows-msvc.exe`
26+
- `codex-aarch64-pc-windows-msvc.exe`
27+
- Add a repo secret `WINGET_PUBLISH_PAT` with `repo` (or `public_repo`) scope for PR submission.
28+
29+
Local test
30+
31+
- Build a versioned manifest set:
32+
- Replace placeholders in the files under `template/` and stage under `manifests/o/OpenAI/Codex/<VERSION>/`.
33+
- Validate:
34+
- `wingetcreate validate manifests/o/OpenAI/Codex/<VERSION>`
35+
- Install locally:
36+
- `winget install --manifest manifests/o/OpenAI/Codex/<VERSION>`

0 commit comments

Comments
 (0)