@@ -26,25 +26,36 @@ jobs:
2626 echo "Version from package.json: $VERSION"
2727 echo "version=$VERSION" >> $GITHUB_OUTPUT
2828
29- - name : Check if tag already exists
29+ - name : Fetch tags from origin
30+ run : |
31+ git fetch --tags --prune
32+
33+ - name : Check if tag already exists (remote)
3034 id : check
3135 run : |
3236 TAG="v${{ steps.pkg.outputs.version }}"
33- if git rev-parse "$TAG" >/dev/null 2>&1; then
34- echo "Tag $TAG already exists. Skipping."
37+ echo "Checking for tag $TAG on remote..."
38+ if git ls-remote --tags origin "$TAG" | grep -q "$TAG"; then
39+ echo "Tag $TAG already exists on remote. Skipping."
3540 echo "exists=true" >> $GITHUB_OUTPUT
3641 else
37- echo "exists=false" >> $GITHUB_OUTPUT
42+ # also check locally as a fallback
43+ if git rev-parse "$TAG" >/dev/null 2>&1; then
44+ echo "Tag $TAG already exists locally. Skipping."
45+ echo "exists=true" >> $GITHUB_OUTPUT
46+ else
47+ echo "exists=false" >> $GITHUB_OUTPUT
48+ fi
3849 fi
3950
40- - name : Create and push tag
51+ - name : Create and push annotated tag
4152 if : steps.check.outputs.exists == 'false'
4253 run : |
4354 git config user.name "github-actions"
4455 git config user.email "github-actions@github.com"
4556
4657 TAG="v${{ steps.pkg.outputs.version }}"
47- git tag " $TAG"
58+ git tag -a "$TAG" -m "Release $TAG"
4859 git push origin "$TAG"
4960
5061 - name : Create GitHub release
5768 🚀 **Automatic Release**
5869
5970 Version: v${{ steps.pkg.outputs.version }}
60- Triggered by merge into \ `prod\ `.
71+ Triggered by merge into `prod`.
6172
6273 Commit: ${{ github.sha }}
0 commit comments