Skip to content

Commit 0e7ca0f

Browse files
ci(release): add tag input to workflow_dispatch for backfilling release assets
When macOS/Linux builds fail during a release event, re-running via workflow_dispatch previously skipped the upload step. The new `tag` input lets callers specify an existing release tag so artifacts are uploaded and the README download table is updated.
1 parent 36e6414 commit 0e7ca0f

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
- macos
1414
- linux
1515
- windows
16+
tag:
17+
description: 'Release tag to attach artifacts to (e.g. v1.0.0). Leave empty to skip upload.'
18+
required: false
19+
default: ''
20+
type: string
1621
release:
1722
types: [published]
1823

@@ -95,11 +100,12 @@ jobs:
95100
run: task ci:notarize TARGET=aarch64-apple-darwin
96101

97102
- name: Upload release assets
98-
if: github.event_name == 'release'
103+
if: github.event_name == 'release' || inputs.tag != ''
99104
env:
100105
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101106
run: |
102-
gh release upload "${{ github.event.release.tag_name }}" \
107+
TAG="${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}"
108+
gh release upload "$TAG" \
103109
target/aarch64-apple-darwin/release/bundle/dmg/*.dmg
104110
105111
- name: Cleanup CI keychain
@@ -140,11 +146,12 @@ jobs:
140146
retention-days: 7
141147

142148
- name: Upload release assets
143-
if: github.event_name == 'release'
149+
if: github.event_name == 'release' || inputs.tag != ''
144150
env:
145151
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146152
run: |
147-
gh release upload "${{ github.event.release.tag_name }}" \
153+
TAG="${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}"
154+
gh release upload "$TAG" \
148155
target/x86_64-unknown-linux-gnu/release/bundle/deb/*.deb
149156
150157
build-linux-arm64:
@@ -196,11 +203,12 @@ jobs:
196203
retention-days: 7
197204

198205
- name: Upload release assets
199-
if: github.event_name == 'release'
206+
if: github.event_name == 'release' || inputs.tag != ''
200207
env:
201208
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
202209
run: |
203-
gh release upload "${{ github.event.release.tag_name }}" \
210+
TAG="${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}"
211+
gh release upload "$TAG" \
204212
dist/linux-arm64/*.deb
205213
206214
build-windows:
@@ -308,7 +316,7 @@ jobs:
308316
update-readme:
309317
name: Update README download links
310318
needs: [build-macos, build-linux-amd64, build-linux-arm64, build-windows]
311-
if: github.event_name == 'release'
319+
if: github.event_name == 'release' || inputs.tag != ''
312320
runs-on: blacksmith-4vcpu-ubuntu-2404
313321

314322
steps:
@@ -320,7 +328,7 @@ jobs:
320328
- name: Update download table
321329
env:
322330
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
323-
TAG: ${{ github.event.release.tag_name }}
331+
TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}
324332
run: |
325333
python3 << 'EOF'
326334
import json, os, re, subprocess
@@ -369,5 +377,5 @@ jobs:
369377
git config user.name "github-actions[bot]"
370378
git config user.email "github-actions[bot]@users.noreply.github.com"
371379
git add README.md
372-
git diff --staged --quiet || git commit -m "chore: update download links for ${{ github.event.release.tag_name }} [skip ci]"
380+
git diff --staged --quiet || git commit -m "chore: update download links for ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }} [skip ci]"
373381
git push origin main

0 commit comments

Comments
 (0)