Skip to content

Commit dab8106

Browse files
MarkShawn2020claude
andcommitted
fix(ci): handle pre-existing tags in release workflow
When a tag is pushed manually before CI runs, the release job would fail on `git tag` and skip the build. Now it detects existing remote tags and still triggers the build job. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5c05237 commit dab8106

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,16 @@ jobs:
4848
run: |
4949
VERSION=$(node -p "require('./package.json').version")
5050
TAG="v$VERSION"
51-
if ! git ls-remote --tags origin | grep -q "refs/tags/$TAG$"; then
51+
if git ls-remote --tags origin | grep -q "refs/tags/$TAG$"; then
52+
echo "Tag $TAG already exists on remote"
53+
echo "tag=$TAG" >> $GITHUB_OUTPUT
54+
else
5255
git config user.name "github-actions[bot]"
5356
git config user.email "github-actions[bot]@users.noreply.github.com"
54-
git tag "$TAG"
57+
git tag -f "$TAG"
5558
git push origin "$TAG"
5659
echo "tag=$TAG" >> $GITHUB_OUTPUT
5760
echo "Pushed tag $TAG"
58-
else
59-
echo "Tag $TAG already exists"
6061
fi
6162
6263
build:

0 commit comments

Comments
 (0)