Skip to content

Commit de62a5d

Browse files
committed
feat: add check to skip already published npm packages
1 parent 7d897b6 commit de62a5d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ jobs:
4343
run: |
4444
for dir in __*_*/dist; do
4545
cd "$dir"
46-
npm publish --access public --provenance
46+
NAME=$(node -p "require('./package.json').name")
47+
VERSION=$(node -p "require('./package.json').version")
48+
49+
if npm view "$NAME@$VERSION" version 2>/dev/null; then
50+
echo "Skipping $NAME@$VERSION (already published)"
51+
else
52+
npm publish --access public --provenance
53+
fi
4754
cd ../..
4855
done
4956
env:

0 commit comments

Comments
 (0)