diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a7672b..af68a3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -158,3 +158,41 @@ jobs: uses: softprops/action-gh-release@v3 with: files: manifests/*.yaml + + # Opens the update PR at microsoft/winget-pkgs automatically. Inert until + # two prerequisites are met, and it skips (green) rather than failing the + # release when they are not: + # 1. `Coderise.OKF4net` exists in winget-pkgs (the action errors out on a + # package with no published version -- the first submission is manual, + # see packaging/winget/README.md); + # 2. a `WINGET_TOKEN` secret (classic PAT, `public_repo` scope) and a fork + # of microsoft/winget-pkgs under the repo owner. + # winget-releaser (komac) derives the new manifests from the ones already + # published in winget-pkgs, so the manifests attached above stay the + # metadata source of truth for the initial submission and metadata edits. + winget-submit: + name: submit winget update PR + needs: winget-manifests + runs-on: ubuntu-latest + steps: + - name: Check for a winget token + id: gate + env: + WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }} + run: | + if [ -z "$WINGET_TOKEN" ]; then + echo "::notice::No WINGET_TOKEN secret; skipping the winget-pkgs PR. The manifests are attached to the Release -- submit them with \`wingetcreate submit\`." + echo "go=false" >> "$GITHUB_OUTPUT" + else + echo "go=true" >> "$GITHUB_OUTPUT" + fi + - name: Submit to microsoft/winget-pkgs + if: steps.gate.outputs.go == 'true' + uses: vedantmgoyal9/winget-releaser@v2 + with: + identifier: Coderise.OKF4net + # `version` is left to the action's default: the release tag with + # its leading `v` stripped. + installers-regex: 'okf-.*-win-(x64|arm64)\.zip$' + release-tag: ${{ github.ref_name }} + token: ${{ secrets.WINGET_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 75a0695..2e98d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,28 @@ and this project adheres to ## [Unreleased] +### Changed + +- **winget manifests move to schema 1.12.0** (from the now-deprecated 1.6.0). + winget-pkgs' automated reviewer flags older schemas, and an unresolved flag + of that kind blocked the first submission + ([winget-pkgs#409311](https://github.com/microsoft/winget-pkgs/pull/409311)) + from merging. The generated manifests pass `winget validate` unchanged + otherwise. The package description also stops advertising OKF v0.1. +- `release.yml` gains a `winget-submit` job that opens the winget-pkgs update + PR automatically on each tag (`winget-releaser`). It skips with a notice + unless a `WINGET_TOKEN` secret is configured, so releases stay green until + the package is published and the token/fork exist — see + `packaging/winget/README.md`. + +### Fixed + +- The CLI's `--version` is now checked against `` in + `Directory.Build.props` by a test. The two are maintained separately and had + drifted: the 0.2.0 winget package shipped a binary printing + `okf 0.1.0-alpha.1`, which the previous test did not catch (it only asserted + the `okf ` prefix). + ## [0.5.0] - 2026-07-31 ### Added diff --git a/packaging/winget/README.md b/packaging/winget/README.md index 7ac50f6..2309463 100644 --- a/packaging/winget/README.md +++ b/packaging/winget/README.md @@ -12,9 +12,11 @@ On every `v*` tag, `.github/workflows/release.yml`: `Publish-Cli.ps1`, producing `okf--.zip` (each containing a single `okf.exe`). 2. Creates the GitHub Release and attaches the two zips + `checksums.txt`. -3. Generates the winget v1.6.0 manifests via `Generate-Manifests.ps1` (SHA256 +3. Generates the winget v1.12.0 manifests via `Generate-Manifests.ps1` (SHA256 read from the built artifacts) and attaches `Coderise.OKF4net*.yaml` to the Release. +4. Opens the update PR at `microsoft/winget-pkgs` (`winget-submit` job) — + inert until the prerequisites below are met, see *Automated submission*. No SHA-pinned YAML is committed; only the templates in `templates/` and the generator script are source-controlled. @@ -54,8 +56,31 @@ SHA256 values come from the Release's `checksums.txt`, or from the local `okf--.zip.sha256` files produced when you run `Publish-Cli.ps1` yourself (these `.sha256` sidecars are not attached to the Release itself). -## Future: automated submission +## Automated submission -Once the package is accepted, wire the `winget-releaser` GitHub Action into -`release.yml` to open the update PR automatically on each release. The existing -generator/templates remain the source of truth for metadata. +`release.yml`'s `winget-submit` job runs +[`winget-releaser`](https://github.com/vedantmgoyal9/winget-releaser) on every +tag to open the update PR at `microsoft/winget-pkgs` by itself. It is wired but +**inert** until both prerequisites are met, and it skips with a notice (green, +not a failed release) when they are not: + +1. **`Coderise.OKF4net` published in winget-pkgs.** The action errors out on a + package with no existing version — the *first* submission is the manual + `wingetcreate submit` flow above. +2. **A `WINGET_TOKEN` repo secret and a winget-pkgs fork** under the repo + owner. The token is a classic PAT with the `public_repo` scope (winget-pkgs + is public); `winget-releaser` pushes the branch to the fork and opens the PR + from it. + +The action derives each new version from the manifests *already published* in +winget-pkgs (via `komac`), not from `templates/` — so the templates here stay +the source of truth for the initial submission and for metadata edits +(description, tags, URLs), which still go through a manual PR. + +## Schema version + +Templates target manifest schema **1.12.0**. winget-pkgs' PR template calls out +the current schema, and its Copilot reviewer flags anything older as deprecated +— an unresolved flag of that kind blocked the 0.2.0 PR from merging. When the +repo moves to a newer schema, bump the three `ManifestVersion` fields and the +three `$schema` URLs together, then re-run `winget validate`. diff --git a/packaging/winget/templates/Coderise.OKF4net.installer.yaml.in b/packaging/winget/templates/Coderise.OKF4net.installer.yaml.in index b84c082..198e878 100644 --- a/packaging/winget/templates/Coderise.OKF4net.installer.yaml.in +++ b/packaging/winget/templates/Coderise.OKF4net.installer.yaml.in @@ -1,4 +1,4 @@ -# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.6.0.schema.json +# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.12.0.schema.json PackageIdentifier: Coderise.OKF4net PackageVersion: {{Version}} MinimumOSVersion: 10.0.0.0 @@ -15,4 +15,4 @@ Installers: InstallerUrl: {{Url_Arm64}} InstallerSha256: {{Sha256_Arm64}} ManifestType: installer -ManifestVersion: 1.6.0 +ManifestVersion: 1.12.0 diff --git a/packaging/winget/templates/Coderise.OKF4net.locale.en-US.yaml.in b/packaging/winget/templates/Coderise.OKF4net.locale.en-US.yaml.in index 72c2c16..01e99ed 100644 --- a/packaging/winget/templates/Coderise.OKF4net.locale.en-US.yaml.in +++ b/packaging/winget/templates/Coderise.OKF4net.locale.en-US.yaml.in @@ -1,4 +1,4 @@ -# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.6.0.schema.json +# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.12.0.schema.json PackageIdentifier: Coderise.OKF4net PackageVersion: {{Version}} PackageLocale: en-US @@ -11,7 +11,7 @@ PackageUrl: https://github.com/jchable/okf4net License: LGPL-3.0-or-later LicenseUrl: https://github.com/jchable/okf4net/blob/main/LICENSE Copyright: Copyright 2026 Julien CHABLE -ShortDescription: Zero-dependency .NET implementation of the Open Knowledge Format (OKF) v0.1 -- parse, validate, index, and graph OKF knowledge bundles. +ShortDescription: Zero-dependency .NET implementation of the Open Knowledge Format (OKF) v0.2 -- parse, validate, index, and graph OKF knowledge bundles. Moniker: okf Tags: - okf @@ -22,4 +22,4 @@ Tags: - frontmatter - knowledge-graph ManifestType: defaultLocale -ManifestVersion: 1.6.0 +ManifestVersion: 1.12.0 diff --git a/packaging/winget/templates/Coderise.OKF4net.yaml.in b/packaging/winget/templates/Coderise.OKF4net.yaml.in index 0ae7f5b..ad069a2 100644 --- a/packaging/winget/templates/Coderise.OKF4net.yaml.in +++ b/packaging/winget/templates/Coderise.OKF4net.yaml.in @@ -1,6 +1,6 @@ -# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.6.0.schema.json +# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.12.0.schema.json PackageIdentifier: Coderise.OKF4net PackageVersion: {{Version}} DefaultLocale: en-US ManifestType: version -ManifestVersion: 1.6.0 +ManifestVersion: 1.12.0 diff --git a/tests/OKF4net.Tests/CliTests.cs b/tests/OKF4net.Tests/CliTests.cs index 80120c8..54abe93 100644 --- a/tests/OKF4net.Tests/CliTests.cs +++ b/tests/OKF4net.Tests/CliTests.cs @@ -1,5 +1,6 @@ // SPDX-License-Identifier: LGPL-3.0-or-later using System.Linq; +using System.Text.RegularExpressions; using OKF4net.Cli; namespace OKF4net.Tests; @@ -55,6 +56,23 @@ public void Version_prints_and_succeeds() Assert.Contains("OKF spec v0.2", r.Out); } + [Fact] + public void Version_matches_the_build_version() + { + // OkfCli.CliVersion is hand-maintained, separate from in + // Directory.Build.props. The two drifted once and the winget package + // for 0.2.0 shipped a binary whose `--version` printed 0.1.0-alpha.1 + // (caught by a Microsoft moderator, not by us). Fail the build here + // instead: Version_prints_and_succeeds only checks the "okf " prefix. + var props = File.ReadAllText(Path.Combine(TestPaths.RepoRoot(), "Directory.Build.props")); + var declared = Regex.Match(props, @"\s*([^<\s]+)\s*"); + Assert.True(declared.Success, "no element in Directory.Build.props"); + + var r = Run("--version"); + Assert.Equal(0, r.Code); + Assert.StartsWith($"okf {declared.Groups[1].Value} ", r.Out); + } + [Fact] public void Validate_conformant_bundle_exits_zero() {