Skip to content

Commit e259aea

Browse files
committed
[skip ci] Support prereleased and manual release dispatch
Allow the workflow to run for prereleased releases and manually via workflow_dispatch with version and channel inputs. Update the determine_channel job to use provided inputs when invoked manually, otherwise extract X.Y.Z from the release name and set the channel to "Preview" if the release name contains that substring, or "Stable" otherwise.
1 parent 2520bdb commit e259aea

1 file changed

Lines changed: 29 additions & 11 deletions

File tree

.github/workflows/release-winget.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
name: Publish Stable & Preview builds to WinGet
22
on:
33
release:
4-
types: [released]
4+
types: [released, prereleased]
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: 'Version to publish (e.g. 1.2.3)'
9+
required: true
10+
type: string
11+
channel:
12+
description: 'Release channel'
13+
required: true
14+
type: choice
15+
options:
16+
- Stable
17+
- Preview
518
jobs:
619
determine_channel:
720
runs-on: ubuntu-latest
@@ -13,18 +26,23 @@ jobs:
1326
id: check
1427
# Find X.Y.Z version, then check for "Preview" after it for regex
1528
run: |
16-
RELEASE_NAME="${{ github.event.release.name }}"
17-
if [[ "$RELEASE_NAME" =~ (\d+\.\d+\.\d+) ]]; then
18-
VERSION="${BASH_REMATCH[1]}"
29+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
30+
VERSION="${{ inputs.version }}"
31+
CHANNEL="${{ inputs.channel }}"
1932
else
20-
echo "Error: Could not find X.Y.Z version in release name."
21-
exit 1
22-
fi
33+
RELEASE_NAME="${{ github.event.release.name }}"
34+
if [[ "$RELEASE_NAME" =~ (\d+\.\d+\.\d+) ]]; then
35+
VERSION="${BASH_REMATCH[1]}"
36+
else
37+
echo "Error: Could not find X.Y.Z version in release name."
38+
exit 1
39+
fi
2340
24-
if [[ "$RELEASE_NAME" == *"Preview"* ]]; then
25-
CHANNEL="Preview"
26-
else
27-
CHANNEL="Stable"
41+
if [[ "$RELEASE_NAME" == *"Preview"* ]]; then
42+
CHANNEL="Preview"
43+
else
44+
CHANNEL="Stable"
45+
fi
2846
fi
2947
3048
echo "Detected Channel: $CHANNEL"

0 commit comments

Comments
 (0)