Files
Meshtastic-Android/.github/workflows/winget-publish.yml
2026-07-12 11:17:04 +00:00

57 lines
2.6 KiB
YAML

name: Publish to winget
# The `released` type fires when a release is published as a full release OR
# when an existing pre-release is flipped to a full release — the latter is
# what promote.yml's production promotion does (`gh release edit
# --prerelease=false` on the already-published release object). It never fires
# for drafts or pre-releases, so internal/closed/open promotions are ignored.
#
# CAVEAT: promote.yml performs that edit with the workflow's own GITHUB_TOKEN,
# and events caused by GITHUB_TOKEN never start workflow runs — so promote.yml
# also dispatches this workflow explicitly (workflow_dispatch is exempt from
# that suppression). The release trigger stays for manually-published releases;
# workflow_dispatch doubles as the manual retry/seed path.
on:
release:
types: [released]
workflow_dispatch:
inputs:
tag:
description: 'Production release tag to publish (e.g., v2.8.0)'
required: true
type: string
# The WINGET_TOKEN PAT does all the work against microsoft/winget-pkgs;
# nothing in this repo is written.
permissions: {}
jobs:
winget:
# Belt and braces for release events — `released` should already exclude
# these. workflow_dispatch has no release payload and passes through.
if: ${{ !github.event.release.prerelease && !github.event.release.draft }}
runs-on: ubuntu-latest
env:
# Secrets aren't readable in step `if:` expressions; skip cleanly until
# the token is configured.
HAS_WINGET_TOKEN: ${{ secrets.WINGET_TOKEN != '' && 'true' || 'false' }}
steps:
# Prerequisites (both manual, one-time):
# 1. Meshtastic.MeshtasticDesktop must already exist in
# microsoft/winget-pkgs — winget-releaser only updates existing
# packages. Submit the first version by hand with `wingetcreate new
# <MSI release asset URL>`.
# 2. WINGET_TOKEN secret: a *classic* PAT with the public_repo scope
# (fine-grained PATs are not supported), owned by an account that
# has (or can create) a fork of microsoft/winget-pkgs.
# The version is derived from the release tag with the leading `v`
# stripped (v2.8.0 -> 2.8.0), matching the MSI's ProductVersion.
- name: Submit MSI manifest to microsoft/winget-pkgs
if: env.HAS_WINGET_TOKEN == 'true'
uses: vedantmgoyal9/winget-releaser@v2
with:
identifier: Meshtastic.MeshtasticDesktop
installers-regex: '\.msi$'
release-tag: ${{ inputs.tag || github.event.release.tag_name }}
token: ${{ secrets.WINGET_TOKEN }}