Skip to content

Publish WinGet Manifest #1

Publish WinGet Manifest

Publish WinGet Manifest #1

Workflow file for this run

name: Publish WinGet Manifest
on:
workflow_dispatch:
inputs:
release_tag:
description: "Stable release tag to publish (e.g. v0.1.0)"
required: true
type: string
permissions:
contents: read
jobs:
winget:
name: Update winget-pkgs
runs-on: windows-latest
env:
WINGET_PAT: ${{ secrets.WINGET_PAT }}
steps:
- name: Resolve target tag
id: meta
shell: pwsh
env:
DISPATCH_RELEASE_TAG: ${{ inputs.release_tag }}
run: |
$tag = $env:DISPATCH_RELEASE_TAG
if ($tag -notmatch '^v\d+\.\d+\.\d+$') {
throw "WinGet publishing only supports stable tags (vMAJOR.MINOR.PATCH). Got: $tag"
}
"release_tag=$tag" >> $env:GITHUB_OUTPUT
- name: Require WinGet PAT
shell: pwsh
run: |
if ([string]::IsNullOrWhiteSpace($env:WINGET_PAT)) {
throw "Missing WINGET_PAT secret. Configure it in repo secrets before publishing WinGet manifests."
}
# fork-user defaults to repository_owner; for org-owned repos, that is the org,
# while WINGET_PAT is often a maintainer's personal classic PAT. Komac then tries to
# CreateRef on org/winget-pkgs and fails. Set repo/org Actions variable WINGET_FORK_USER
# to the GitHub login that owns both the microsoft/winget-pkgs fork and the PAT.
- name: Publish to WinGet
uses: vedantmgoyal9/winget-releaser@4ffc7888bffd451b357355dc214d43bb9f23917e # v2
with:
identifier: git-rain.git-rain
release-tag: ${{ steps.meta.outputs.release_tag }}
installers-regex: '_windows_(amd64|arm64|386)\.zip$'
token: ${{ env.WINGET_PAT }}
fork-user: ${{ vars.WINGET_FORK_USER || github.repository_owner }}