Skip to content

Commit cdac0dc

Browse files
committed
ci: support uploading desktop builds to existing release via workflow_dispatch
1 parent 898cf22 commit cdac0dc

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/desktop-release.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
tags:
66
- 'desktop-v*'
77
workflow_dispatch:
8+
inputs:
9+
release_tag:
10+
description: 'Upload to existing release (e.g. v1.0.0). Leave empty for build-only.'
11+
required: false
12+
type: string
813

914
permissions:
1015
contents: write
@@ -60,7 +65,7 @@ jobs:
6065
6166
build:
6267
needs: create-release
63-
if: always()
68+
if: always() && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped')
6469
strategy:
6570
fail-fast: false
6671
matrix:
@@ -138,15 +143,27 @@ jobs:
138143

139144
# Upload directly to release via GitHub API (gh CLI truncates large files)
140145
- name: Upload to release
141-
if: startsWith(github.ref, 'refs/tags/desktop-v')
146+
if: startsWith(github.ref, 'refs/tags/desktop-v') || inputs.release_tag != ''
142147
shell: bash
143148
env:
144149
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145150
run: |
146-
# Get release ID (draft releases are not queryable by tag, use list API)
151+
# Determine which release to upload to
152+
if [ -n "${{ inputs.release_tag }}" ]; then
153+
RELEASE_TAG="${{ inputs.release_tag }}"
154+
else
155+
RELEASE_TAG="${{ github.ref_name }}"
156+
fi
157+
echo "Target release: $RELEASE_TAG"
158+
147159
RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
148160
"https://api.github.com/repos/${{ github.repository }}/releases" \
149-
| jq -r '.[] | select(.tag_name == "${{ github.ref_name }}") | .id' | head -1)
161+
| jq -r --arg tag "$RELEASE_TAG" '.[] | select(.tag_name == $tag) | .id' | head -1)
162+
163+
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" = "null" ]; then
164+
echo "Release not found for tag: $RELEASE_TAG"
165+
exit 1
166+
fi
150167
echo "Release ID: $RELEASE_ID"
151168
152169
for file in apps/desktop/release/*.dmg apps/desktop/release/*.zip apps/desktop/release/*.exe; do

0 commit comments

Comments
 (0)