Skip to content

feat(ci): Add automated Winget publishing to release workflow#46

Merged
rianjs merged 1 commit intomainfrom
feat/winget-workflow
Jan 17, 2026
Merged

feat(ci): Add automated Winget publishing to release workflow#46
rianjs merged 1 commit intomainfrom
feat/winget-workflow

Conversation

@rianjs
Copy link
Copy Markdown
Collaborator

@rianjs rianjs commented Jan 17, 2026

Summary

Add automated Winget publishing to the release workflow, plus validation and manual retry workflows.

Changes

.github/workflows/release.yml

Added winget job that:

  1. Waits for goreleaser job to complete
  2. Downloads wingetcreate tool
  3. Checks if manifest exists in microsoft/winget-pkgs
  4. If exists: uses wingetcreate update with download URLs
  5. If new: processes templates, validates, and uses wingetcreate submit
  6. Uses .NET regex for sequential checksum replacement

.github/workflows/winget-publish.yml (New)

Manual workflow for retrying failed submissions:

  • Takes version input (e.g., 1.0.14)
  • Validates the release exists
  • Same new vs update detection logic

.github/workflows/test-winget.yml (New)

Validation workflow triggered on:

  • PRs touching packaging/winget/**
  • Pushes to main touching packaging/winget/**

Performs:

  • Creates test directory with processed manifests
  • Substitutes test version (0.0.1) and dummy checksums
  • Runs winget validate --manifest to check schema

Required Secrets

Secret How to Obtain
WINGET_GITHUB_TOKEN GitHub PAT with public_repo scope

Technical Details

Manifest Existence Check:

$response = Invoke-WebRequest -Uri "https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/o/OpenCliCollective/newrelic-cli" -Method Head -SkipHttpErrorCheck

Sequential Checksum Replacement (PowerShell quirk):

$regex = [regex]"0{64}"
$content = $regex.Replace($content, $env:X64_HASH, 1)   # First match
$content = $regex.Replace($content, $env:ARM64_HASH, 1) # Second match

Workflow Diagram

Tag Push → GoReleaser → Winget Job
                           ↓
                     Download wingetcreate
                           ↓
                     Check manifest exists?
                           ↓
              ┌────────────┴────────────┐
              ↓                         ↓
         [Exists]                   [New]
              ↓                         ↓
     wingetcreate update       Process templates
              ↓                         ↓
              └────────────┬────────────┘
                           ↓
                 Submit PR to winget-pkgs

Closes #39

Add Winget publishing automation:

- Add `winget` job to release.yml that runs after goreleaser:
  - Checks if manifest exists in microsoft/winget-pkgs
  - If exists: uses wingetcreate update command
  - If new: processes templates and uses wingetcreate submit
  - Uses .NET regex for sequential checksum replacement

- Create winget-publish.yml for manual publishing:
  - workflow_dispatch with version input
  - Validates release exists before publishing
  - Same logic for new vs existing packages

- Create test-winget.yml for manifest validation:
  - Runs on PRs touching packaging/winget/**
  - Substitutes test version and dummy checksums
  - Runs winget validate to check schema

Requires WINGET_GITHUB_TOKEN secret (PAT with public_repo scope).
@rianjs rianjs merged commit 938ec5e into main Jan 17, 2026
3 checks passed
@rianjs rianjs deleted the feat/winget-workflow branch January 17, 2026 21:48
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.

feat(ci): Add automated Winget publishing to release workflow

1 participant