Skip to content

Commit 092ea22

Browse files
fix: Apply suggestions from code review
Co-authored-by: Copilot <[email protected]>
1 parent 9c91ba6 commit 092ea22

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

.github/workflows/npmpublish.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
id-token: write # Required for OIDC
2727
steps:
2828
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
2931
- uses: actions/setup-node@v4
3032
with:
3133
node-version: lts/*
@@ -37,7 +39,13 @@ jobs:
3739
- run: |
3840
git config --global user.name 'github-actions[bot]'
3941
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
40-
- run: |
41-
git tag "v$(jq -r .version package.json)"
42-
git push origin "v$(jq -r .version package.json)"
43-
- run: npm publish
42+
- name: Create and push git tag if not exists
43+
run: |
44+
TAG="v$(jq -r .version package.json)"
45+
if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
46+
echo "Tag $TAG already exists. Skipping tag creation and push."
47+
else
48+
git tag "$TAG"
49+
git push origin "$TAG"
50+
fi
51+
- run: npm publish --provenance

0 commit comments

Comments
 (0)