Skip to content

Commit df9eff2

Browse files
committed
fix: pass release tag to build workflows for asset uploads
Build workflows need the tag to upload assets to the correct GitHub Release. When called via workflow_call from release.yml, GITHUB_REF is refs/heads/main (not a tag). Add tag input to release-desktop and release-mobile workflows. Resolve tag from: explicit input > GITHUB_REF tag > git describe. Also include relay binaries in desktop release assets.
1 parent 332840b commit df9eff2

3 files changed

Lines changed: 72 additions & 7 deletions

File tree

.github/workflows/release-desktop.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ on:
44
push:
55
tags: ['v*']
66
workflow_call:
7+
inputs:
8+
tag:
9+
description: 'Release tag (e.g. v0.5.1-alpha). Auto-detected from git when triggered by tag push.'
10+
required: false
11+
type: string
712
workflow_dispatch:
13+
inputs:
14+
tag:
15+
description: 'Release tag to upload assets to (e.g. v0.5.1-alpha)'
16+
required: false
17+
type: string
818

919
permissions:
1020
contents: write
@@ -195,23 +205,43 @@ jobs:
195205
name: relay-${{ matrix.name }}
196206
path: helios-relay-${{ matrix.name }}
197207

198-
create-release:
199-
needs: [build-macos, build-linux, build-windows]
208+
upload-assets:
209+
needs: [build-macos, build-linux, build-windows, build-relay]
200210
if: ${{ always() && (needs.build-linux.result == 'success' || needs.build-windows.result == 'success' || needs.build-macos.result == 'success') }}
201211
runs-on: ubuntu-latest
202212
steps:
213+
- uses: actions/checkout@v4
214+
with:
215+
fetch-depth: 0
216+
217+
- name: Resolve release tag
218+
id: tag
219+
env:
220+
INPUT_TAG: ${{ inputs.tag }}
221+
run: |
222+
if [ -n "$INPUT_TAG" ]; then
223+
echo "tag=$INPUT_TAG" >> "$GITHUB_OUTPUT"
224+
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
225+
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
226+
else
227+
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
228+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
229+
fi
230+
203231
- uses: actions/download-artifact@v4
204232
with:
205233
path: artifacts
206234

207-
- name: Create GitHub Release
235+
- name: Upload assets to GitHub Release
236+
if: ${{ steps.tag.outputs.tag != '' }}
208237
uses: softprops/action-gh-release@v2
209238
with:
210-
generate_release_notes: true
239+
tag_name: ${{ steps.tag.outputs.tag }}
211240
fail_on_unmatched_files: false
212241
files: |
213242
artifacts/macos-dmg/helios-gcs-macos.dmg
214243
artifacts/linux-tarball/helios-gcs-linux-x64.tar.gz
215244
artifacts/linux-appimage/helios-gcs-linux-x64.AppImage
216245
artifacts/windows-zip/helios-gcs-windows-x64.zip
217246
artifacts/windows-installer/helios-gcs-windows-x64-setup.exe
247+
artifacts/relay-*/helios-relay-*

.github/workflows/release-mobile.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@ on:
44
push:
55
tags: ['v*']
66
workflow_call:
7+
inputs:
8+
tag:
9+
description: 'Release tag (e.g. v0.5.1-alpha). Auto-detected from git when triggered by tag push.'
10+
required: false
11+
type: string
712
workflow_dispatch:
13+
inputs:
14+
tag:
15+
description: 'Release tag to upload assets to (e.g. v0.5.1-alpha)'
16+
required: false
17+
type: string
818

919
permissions:
1020
contents: write
@@ -128,18 +138,39 @@ jobs:
128138
name: ios-ipa
129139
path: build/ios/ipa/*.ipa
130140

131-
upload-to-release:
141+
upload-assets:
132142
needs: [build-android, build-ios]
133143
if: ${{ always() && (needs.build-android.result == 'success' || needs.build-ios.result == 'success') }}
134144
runs-on: ubuntu-latest
135145
steps:
146+
- uses: actions/checkout@v4
147+
with:
148+
fetch-depth: 0
149+
150+
- name: Resolve release tag
151+
id: tag
152+
env:
153+
INPUT_TAG: ${{ inputs.tag }}
154+
run: |
155+
if [ -n "$INPUT_TAG" ]; then
156+
echo "tag=$INPUT_TAG" >> "$GITHUB_OUTPUT"
157+
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
158+
echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
159+
else
160+
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
161+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
162+
fi
163+
136164
- uses: actions/download-artifact@v4
137165
with:
138166
path: artifacts
139167

140168
- name: Upload to GitHub Release
169+
if: ${{ steps.tag.outputs.tag != '' }}
141170
uses: softprops/action-gh-release@v2
142171
with:
172+
tag_name: ${{ steps.tag.outputs.tag }}
173+
fail_on_unmatched_files: false
143174
files: |
144175
artifacts/android-apk/app-release.apk
145176
artifacts/android-aab/app-release.aab

.github/workflows/release.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,17 @@ jobs:
130130
# Tags pushed by GITHUB_TOKEN don't trigger other workflows, so we
131131
# call them explicitly here.
132132
build-desktop:
133-
needs: create-release
133+
needs: [create-release, bump-version]
134134
uses: ./.github/workflows/release-desktop.yml
135+
with:
136+
tag: ${{ needs.bump-version.outputs.tag }}
135137
secrets: inherit
136138

137139
build-mobile:
138-
needs: create-release
140+
needs: [create-release, bump-version]
139141
uses: ./.github/workflows/release-mobile.yml
142+
with:
143+
tag: ${{ needs.bump-version.outputs.tag }}
140144
secrets: inherit
141145

142146
deploy-webapp:

0 commit comments

Comments
 (0)