Skip to content

Commit 359fec4

Browse files
committed
Fix workflow tag check
1 parent 92d5002 commit 359fec4

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

.github/workflows/release-mcpb.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
uses: actions/checkout@v4
2828
with:
2929
fetch-depth: 0
30+
fetch-tags: true
3031

3132
- name: Setup Node.js
3233
uses: actions/setup-node@v4
@@ -50,20 +51,22 @@ jobs:
5051
id: check_tag
5152
run: |
5253
TAG="v${{ steps.version.outputs.VERSION }}"
54+
55+
# Fetch all tags from remote
56+
git fetch --tags --force
57+
58+
# Check if tag exists locally or remotely
5359
if git rev-parse "$TAG" >/dev/null 2>&1; then
5460
echo "exists=true" >> $GITHUB_OUTPUT
55-
echo "Tag $TAG already exists, skipping release"
61+
echo "::warning::Tag $TAG already exists locally, skipping release"
62+
elif git ls-remote --tags origin | grep -q "refs/tags/$TAG"; then
63+
echo "exists=true" >> $GITHUB_OUTPUT
64+
echo "::warning::Tag $TAG already exists on remote, skipping release"
5665
else
5766
echo "exists=false" >> $GITHUB_OUTPUT
5867
echo "Tag $TAG does not exist, will create release"
5968
fi
6069
61-
- name: Stop if tag exists
62-
if: steps.check_tag.outputs.exists == 'true'
63-
run: |
64-
echo "::notice::Tag v${{ steps.version.outputs.VERSION }} already exists. Skipping release."
65-
exit 0
66-
6770
- name: Sync version across files
6871
if: steps.check_tag.outputs.exists == 'false'
6972
run: |

0 commit comments

Comments
 (0)