Skip to content

Commit ae5d2aa

Browse files
lostindarkCopilot
andcommitted
feat: add manual trigger to WinGet publish workflow
Accepts a tag input (e.g. v1.0.0) for manual dispatch. Looks up the release by tag instead of using the event payload, so it works for both release events and manual triggers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7ac6df1 commit ae5d2aa

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/winget.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Publish to WinGet
33
on:
44
release:
55
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: 'Release tag (e.g. v1.0.0)'
10+
required: true
11+
type: string
612

713
jobs:
814
publish:
@@ -14,8 +20,12 @@ jobs:
1420
WINGET_CREATE_GITHUB_TOKEN: ${{ secrets.WINGET_CREATE_GITHUB_TOKEN }}
1521
shell: pwsh
1622
run: |
17-
$version = '${{ github.event.release.tag_name }}'.TrimStart('v')
18-
$release = gh api "repos/${{ github.repository }}/releases/${{ github.event.release.id }}" | ConvertFrom-Json
23+
$tag = '${{ inputs.tag || github.event.release.tag_name }}'
24+
if (-not $tag.StartsWith('v')) { $tag = "v$tag" }
25+
$version = $tag.TrimStart('v')
26+
$releases = gh api "repos/${{ github.repository }}/releases" | ConvertFrom-Json
27+
$release = $releases | Where-Object { $_.tag_name -eq $tag -and -not $_.draft } | Select-Object -First 1
28+
if (-not $release) { throw "Published release for tag '$tag' not found" }
1929
$asset = $release.assets | Where-Object { $_.name -like 'DriverStoreExplorer-v*.zip' } | Select-Object -First 1
2030
if (-not $asset) { throw "No DriverStoreExplorer zip asset found in release" }
2131

0 commit comments

Comments
 (0)