Skip to content

packaging: template winget manifests and add release publishing - #500

Draft
inqrphl wants to merge 8 commits into
mainfrom
winget-templates
Draft

inqrphl wants to merge 8 commits into
mainfrom
winget-templates

Conversation

@inqrphl

@inqrphl inqrphl commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI GENERATED

Summary

This PR turns the WinGet manifests into templates.
It generates the manifests during the release workflow.
It validates the generated manifests with winget validate.
It attaches the manifests to the draft release.
It publishes the manifests through the GitHub API without cloning winget-pkgs.
It supersedes #496.

Package identifier

The package identifier stays ConSol.SNClient.

Two versions

TAG_VERSION is the release tag without the leading v.
PACKAGE_VERSION is the MSI ProductVersion and the ARP DisplayVersion.
WinGet PackageVersion must match the installed MSI.
Installer URLs use TAG_VERSION.
The generated manifests are in packaging/winget/<package-version>/.

What changed

  • Add packaging/winget/templates/*.yaml.in.
  • Add buildtools/winget_manifests.sh.
  • Add buildtools/winget_manifests.ps1.
  • Add buildtools/get_winget_version.
  • Add the winget-manifests Makefile target.
  • Add packaging/winget/.gitignore for generated version directories.
  • Remove the static 1.01.0 manifests.
  • Add pkg-winget to the release workflow.
  • Add upload-winget-manifests to attach the zip to the draft release.
  • Add .github/workflows/winget.yml for API publishing.
  • Split the publish token into WINGET_FORK_TOKEN and WINGET_PR_TOKEN.
  • Update packaging/RELEASE.md.

build_msi.ps1 is unchanged.
The PowerShell generator reads ProductCode, ProductVersion and SHA256 from the MSIs.

Release and publish flow

  1. The tag build creates the three MSIs.
  2. pkg-winget reads the MSIs and generates the manifests.
  3. pkg-winget runs winget validate.
  4. pkg-winget creates snclient-<tag>-winget-manifests.zip.
  5. upload-winget-manifests attaches the zip to the draft release.
  6. The release is published.
  7. The fine-grained WINGET_FORK_TOKEN creates the branch and commit in the fork.
  8. The classic WINGET_PR_TOKEN opens the PR in microsoft/winget-pkgs.

The publish workflow uses the GitHub API to create blobs, a tree, a commit and a branch in the fork.
The classic token opens the PR in microsoft/winget-pkgs.
It does not clone the 500k-commit winget-pkgs repository.
A fork is still required for the PR head branch.
The fork does not need to be current.
The commit is based on the fork master.
The PR adds only the new version directory.
The PR can show an out-of-date branch.
That is expected.

Automation switch

WINGET_AUTOPUBLISH is set to false in the repository.
The release job is skipped while it is false.
Set it to true after the first package is merged.
Manual workflow_dispatch runs with dry_run=true by default.
Set dry_run=false to publish manually.

Setup:

  • Create a fork of microsoft/winget-pkgs.
  • Set WINGET_FORK_OWNER to inqrphl.
  • Add a fine-grained PAT as WINGET_FORK_TOKEN.
  • The fine-grained token needs Contents: Read and write on inqrphl/winget-pkgs.
  • Add a classic PAT with public_repo as WINGET_PR_TOKEN.
  • The classic token opens the PR in microsoft/winget-pkgs.
  • The fine-grained token owner must have write access to the fork.
  • The classic token owner must own the fork.

Supersedes #496

#496 used vedantmgoyal9/winget-releaser and the identifier ConSolMonitoring.SNClient.
It also used the release tag as the package version, which would be 1.02 instead of 1.02.0.
This PR keeps the release trigger and the fork setup.
It replaces the action with the generated manifests and the API publisher.
It uses ConSol.SNClient and the MSI version.

Validation

  • The PowerShell generator was run with the three v1.01.0 release MSIs.
  • Its output matches the previously validated v1.01.0 manifests exactly.
  • The templates and workflows parse as YAML.
  • ShellCheck passes for both shell scripts.
  • winget validate succeeded on the generated 1.01.0 manifests.
  • The CI job runs winget validate on every release.
  • The shell generator was run on Linux.
  • Its output matches the v1.01.0 manifests exactly.

Reviewer test on Linux:

WINGET_PACKAGE_VERSION=1.01.0 \
WINGET_TAG_VERSION=1.01 \
WINGET_RELEASE_DATE=2026-10-29 \
WINGET_OUTDIR=packaging/winget/1.01.0 \
WINGET_SHA256_X64=... \
WINGET_SHA256_X86=... \
WINGET_SHA256_ARM64=... \
WINGET_PRODUCTCODE_X64='{...}' \
WINGET_PRODUCTCODE_X86='{...}' \
WINGET_PRODUCTCODE_ARM64='{...}' \
./buildtools/winget_manifests.sh

Reviewer test on Windows:

.\buildtools\winget_manifests.ps1 `
  -TagVersion 1.01 `
  -ReleaseDate 2026-10-29 `
  -MsiX64 <x64.msi> `
  -MsiX86 <x86.msi> `
  -MsiArm64 <arm64.msi>
winget validate --manifest packaging\winget\1.01.0

First submission

The first v1.01.0 submission is manual.
Generate the 1.01.0 manifests from the three release MSIs.
Copy them to manifests/c/ConSol/SNClient/1.01.0/.
WINGET_AUTOPUBLISH stays false until that PR is merged.

Checklist

  • PowerShell generator matches the validated 1.01.0 manifests.
  • Templates and workflows parse.
  • ShellCheck passes for both shell scripts.
  • Shell generator run on Linux.
  • Local winget validate of the generated 1.01.0 manifests.
  • pkg-winget job runs on the next tag.
  • First winget-pkgs submission.

inqrphl and others added 8 commits November 13, 2026 18:31
Add shell and PowerShell manifest generators.
Generate and validate manifests in the release workflow.
Publish through the GitHub API without cloning winget-pkgs.
Supersede the winget-releaser workflow from #496.
Run the version helper from the repository root.
Avoid GNU dirname and cd options.
Use an explicit empty CDPATH for the script directory lookup.
Create the new version commit on the fork master.
The PR adds only the new version directory.
Use a fine-grained token for fork branch and commit writes.
Use a classic public_repo token for the upstream pull request.
Match the token name to the WINGET_FORK_OWNER variable.
The PR token stays WINGET_PR_TOKEN.
$message = if ($isNewPackage) { "New package: $packageIdentifier $packageVersion" } else { "Update $packageIdentifier to $packageVersion" }
# The fork master can be behind upstream.
# The PR adds only the new version directory, so the fork does not need to be current.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the most complicated part of the PR, and the hardest script section starts here.

uses the github HTTP API to create a new branch, upload files as blobs? , generates a commit JSON, uploads it etc.

Did not look into the references for every API call here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant