File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Publish to npm
22
33on :
4+ push :
5+ branches : [master]
46 release :
57 types : [published]
8+ workflow_dispatch :
69
710permissions :
811 contents : read
912
1013jobs :
1114 publish :
1215 runs-on : ubuntu-latest
16+ # Only publish if it's a push to master or a release
17+ if : github.event_name == 'release' || github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/master')
1318
1419 steps :
1520 - uses : actions/checkout@v4
3035 - name : Test
3136 run : npm test
3237
33- - name : Publish
34- run : npm publish --access public
38+ - name : Publish to npm
39+ run : |
40+ # Try to publish, but don't fail if the version is already published
41+ npm publish --access public || echo "Version already published or publish failed. Skipping."
3542 env :
3643 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments