Skip to content

Commit 7b3251b

Browse files
committed
fix(release): allow rebuilding existing tags
1 parent 74c2bb9 commit 7b3251b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/desktop-release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
outputs:
3232
tag: ${{ steps.release_meta.outputs.tag }}
3333
version: ${{ steps.release_meta.outputs.version }}
34+
tag_exists: ${{ steps.check_tag.outputs.exists }}
3435
steps:
3536
- uses: actions/checkout@v4
3637
with:
@@ -48,21 +49,26 @@ jobs:
4849
echo "version=$version" >> "$GITHUB_OUTPUT"
4950
echo "tag=v$version" >> "$GITHUB_OUTPUT"
5051
51-
- name: Fail if tag already exists
52+
- id: check_tag
53+
name: Check if tag already exists
5254
env:
5355
RELEASE_TAG: ${{ steps.release_meta.outputs.tag }}
5456
run: |
5557
if git ls-remote --exit-code --tags origin "refs/tags/$RELEASE_TAG" >/dev/null 2>&1; then
56-
echo "::error::Release tag $RELEASE_TAG already exists on origin. Use a new version or recreate the tag deliberately before releasing."
57-
exit 1
58+
echo "exists=true" >> "$GITHUB_OUTPUT"
59+
echo "::notice::Release tag $RELEASE_TAG already exists on origin. Reusing the existing tag and release entry."
60+
else
61+
echo "exists=false" >> "$GITHUB_OUTPUT"
5862
fi
5963
6064
- name: Sync repository versions
65+
if: steps.check_tag.outputs.exists != 'true'
6166
env:
6267
RELEASE_VERSION: ${{ steps.release_meta.outputs.version }}
6368
run: node scripts/sync-version.mjs --set "$RELEASE_VERSION"
6469

6570
- name: Commit release metadata
71+
if: steps.check_tag.outputs.exists != 'true'
6672
env:
6773
RELEASE_VERSION: ${{ steps.release_meta.outputs.version }}
6874
run: |
@@ -74,11 +80,13 @@ jobs:
7480
fi
7581
7682
- name: Create release tag
83+
if: steps.check_tag.outputs.exists != 'true'
7784
env:
7885
RELEASE_TAG: ${{ steps.release_meta.outputs.tag }}
7986
run: git tag "$RELEASE_TAG"
8087

8188
- name: Push release commit and tag
89+
if: steps.check_tag.outputs.exists != 'true'
8290
env:
8391
RELEASE_TAG: ${{ steps.release_meta.outputs.tag }}
8492
RELEASE_BRANCH: ${{ github.ref_name }}

docs/releases.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ The workflow will:
2929
5. Build macOS and Windows desktop bundles
3030
6. Upload the generated installers to that release
3131

32+
If the requested tag already exists, the manual workflow reuses that existing tag and GitHub release entry. That makes it possible to rebuild and replace assets for the same version when fixing signing or packaging problems.
33+
3234
The workflow also runs automatically on `v*` tag pushes. That makes it compatible with the existing Changesets-based npm release flow: once the npm release workflow tags a version, desktop artifacts are attached to the same GitHub release.
3335

3436
## Repository prerequisites

0 commit comments

Comments
 (0)