File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 2626 - name : Verify package
2727 run : npm pack --dry-run
2828
29- - run : npm publish --provenance --access public
29+ - name : Check if version already published
30+ id : check
31+ run : |
32+ PKG_NAME=$(node -p "require('./package.json').name")
33+ PKG_VERSION=$(node -p "require('./package.json').version")
34+ if npm view "${PKG_NAME}@${PKG_VERSION}" version 2>/dev/null; then
35+ echo "already_published=true" >> "$GITHUB_OUTPUT"
36+ echo "⚠️ ${PKG_NAME}@${PKG_VERSION} already published, skipping"
37+ else
38+ echo "already_published=false" >> "$GITHUB_OUTPUT"
39+ fi
40+
41+ - name : Publish to npm
42+ if : steps.check.outputs.already_published != 'true'
43+ run : npm publish --provenance --access public
3044 env :
3145 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments