Skip to content

Commit ac3be75

Browse files
authored
Fix workflow dispatch defaulting to dev version (#379)
1 parent a1663b8 commit ac3be75

File tree

4 files changed

+43
-8
lines changed

4 files changed

+43
-8
lines changed

.github/workflows/build-executable.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Build Executables
22

33
on:
44
workflow_call:
5+
inputs:
6+
app_version:
7+
description: 'Application version'
8+
type: string
9+
required: false
10+
default: ''
511

612
jobs:
713
# Build for each platform in parallel using matrix strategy
@@ -27,7 +33,11 @@ jobs:
2733
run: |
2834
ref=${{ github.ref }}
2935
30-
if [[ "$ref" =~ ^refs/tags/ ]]; then
36+
# Use input version if provided, otherwise determine from ref
37+
if [[ -n "${{ inputs.app_version }}" ]]; then
38+
appVersion="${{ inputs.app_version }}"
39+
releaseVersion="v$appVersion"
40+
elif [[ "$ref" =~ ^refs/tags/ ]]; then
3141
releaseVersion=${ref##refs/tags/}
3242
appVersion=${releaseVersion#v}
3343
else

.github/workflows/build-macos-installer.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ permissions:
55

66
on:
77
workflow_call:
8+
inputs:
9+
app_version:
10+
description: 'Application version'
11+
type: string
12+
required: false
13+
default: ''
814

915
jobs:
1016
build-macos-installer:
@@ -31,8 +37,11 @@ jobs:
3137
repoFullName=${{ github.repository }}
3238
ref=${{ github.ref }}
3339
34-
# Handle both tag events and manual dispatch
35-
if [[ "$ref" =~ ^refs/tags/ ]]; then
40+
# Use input version if provided, otherwise determine from ref
41+
if [[ -n "${{ inputs.app_version }}" ]]; then
42+
appVersion="${{ inputs.app_version }}"
43+
releaseVersion="v$appVersion"
44+
elif [[ "$ref" =~ ^refs/tags/ ]]; then
3645
releaseVersion=${ref##refs/tags/}
3746
appVersion=${releaseVersion#v}
3847
else

.github/workflows/build-windows-installer.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Build Windows Installer
22

33
on:
44
workflow_call:
5+
inputs:
6+
app_version:
7+
description: 'Application version'
8+
type: string
9+
required: false
10+
default: ''
511

612
jobs:
713
build-windows-installer:
@@ -13,19 +19,23 @@ jobs:
1319
run: |
1420
$repoFullName = "${{ github.repository }}"
1521
$ref = "${{ github.ref }}"
16-
17-
# Handle both tag events and manual dispatch
18-
if ($ref -match "^refs/tags/") {
22+
$inputVersion = "${{ inputs.app_version }}"
23+
24+
# Use input version if provided, otherwise determine from ref
25+
if ($inputVersion -ne "") {
26+
$appVersion = $inputVersion
27+
$releaseVersion = "v$appVersion"
28+
} elseif ($ref -match "^refs/tags/") {
1929
$releaseVersion = $ref -replace "refs/tags/", ""
2030
$appVersion = $releaseVersion -replace "^v", ""
2131
} else {
2232
# For manual dispatch, use a default version
2333
$releaseVersion = "dev-$(Get-Date -Format 'yyyyMMdd-HHmmss')"
2434
$appVersion = "0.0.1-dev"
2535
}
26-
36+
2737
$repositoryName = $repoFullName.Split("/")[1]
28-
38+
2939
echo "githubRepository=${{ github.repository }}" >> $env:GITHUB_ENV
3040
echo "githubRepositoryName=$repositoryName" >> $env:GITHUB_ENV
3141
echo "releaseVersion=$releaseVersion" >> $env:GITHUB_ENV

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ jobs:
105105
needs.build-frontend.result == 'success' &&
106106
(needs.validate.outputs.is_tag == 'true' || github.event.inputs.buildBinaries == 'true')
107107
uses: ./.github/workflows/build-executable.yml
108+
with:
109+
app_version: ${{ needs.validate.outputs.app_version }}
108110
secrets: inherit
109111

110112
# Build Windows installer
@@ -117,6 +119,8 @@ jobs:
117119
needs.build-frontend.result == 'success' &&
118120
(needs.validate.outputs.is_tag == 'true' || github.event.inputs.buildBinaries == 'true')
119121
uses: ./.github/workflows/build-windows-installer.yml
122+
with:
123+
app_version: ${{ needs.validate.outputs.app_version }}
120124
secrets: inherit
121125

122126
# Build macOS installers (Intel and ARM)
@@ -129,6 +133,8 @@ jobs:
129133
needs.build-frontend.result == 'success' &&
130134
(needs.validate.outputs.is_tag == 'true' || github.event.inputs.buildBinaries == 'true')
131135
uses: ./.github/workflows/build-macos-installer.yml
136+
with:
137+
app_version: ${{ needs.validate.outputs.app_version }}
132138
secrets: inherit
133139

134140
# Build and push Docker image(s)

0 commit comments

Comments
 (0)