|
5 | 5 | tags: |
6 | 6 | - 'desktop-v*' |
7 | 7 | 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 |
8 | 13 |
|
9 | 14 | permissions: |
10 | 15 | contents: write |
|
60 | 65 |
|
61 | 66 | build: |
62 | 67 | needs: create-release |
63 | | - if: always() |
| 68 | + if: always() && (needs.create-release.result == 'success' || needs.create-release.result == 'skipped') |
64 | 69 | strategy: |
65 | 70 | fail-fast: false |
66 | 71 | matrix: |
@@ -138,15 +143,27 @@ jobs: |
138 | 143 |
|
139 | 144 | # Upload directly to release via GitHub API (gh CLI truncates large files) |
140 | 145 | - 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 != '' |
142 | 147 | shell: bash |
143 | 148 | env: |
144 | 149 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
145 | 150 | 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 | +
|
147 | 159 | RELEASE_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ |
148 | 160 | "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 |
150 | 167 | echo "Release ID: $RELEASE_ID" |
151 | 168 |
|
152 | 169 | for file in apps/desktop/release/*.dmg apps/desktop/release/*.zip apps/desktop/release/*.exe; do |
|
0 commit comments