File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,16 @@ name: Release (npm)
22
33on :
44 push :
5- tags :
6- - ' v*'
5+ branches : [ main ] # run on main pushes (build/test only)
6+ tags : [ 'v*' ] # run on version tags (full release)
77
88permissions :
9- contents : write # needed to create a GitHub Release
9+ contents : write # needed to create GitHub Releases
1010
1111jobs :
12- publish :
12+ release :
1313 runs-on : ubuntu-latest
14+
1415 steps :
1516 - name : Checkout
1617 uses : actions/checkout@v4
@@ -31,12 +32,16 @@ jobs:
3132 - name : Build
3233 run : npm run build
3334
35+ # Only publish to npm on version tags (refs/tags/vX.Y.Z)
3436 - name : Publish to npm
37+ if : startsWith(github.ref, 'refs/tags/v')
3538 env :
3639 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
3740 run : npm publish --access public
3841
42+ # Only create a GitHub Release on version tags
3943 - name : Create GitHub Release
44+ if : startsWith(github.ref, 'refs/tags/v')
4045 uses : softprops/action-gh-release@v1
4146 with :
4247 generate_release_notes : true
Original file line number Diff line number Diff line change 33[ ![ npm version] ( https://img.shields.io/npm/v/string-utils-lite?color=blue )] ( https://www.npmjs.com/package/string-utils-lite )
44[ ![ npm downloads] ( https://img.shields.io/npm/dm/string-utils-lite.svg )] ( https://www.npmjs.com/package/string-utils-lite )
55[ ![ CI] ( https://img.shields.io/github/actions/workflow/status/jahirultusar/JavaScript-string-utils-lite/ci.yml?branch=main )] ( https://github.com/jahirultusar/JavaScript-string-utils-lite/actions/workflows/ci.yml )
6- [ ![ Release] ( https://img.shields.io/github/actions/workflow/status/ jahirultusar/JavaScript-string-utils-lite/release.yml?branch=main )] ( https://github.com/jahirultusar/JavaScript-string-utils-lite/actions/workflows/release.yml )
6+ [ ![ Release] ( https://github.com/ jahirultusar/JavaScript-string-utils-lite/actions/workflows/ release.yml/badge.svg )] ( https://github.com/jahirultusar/JavaScript-string-utils-lite/actions/workflows/release.yml )
77[ ![ license] ( https://img.shields.io/github/license/jahirultusar/JavaScript-string-utils-lite )] ( ./LICENSE )
88
99
You can’t perform that action at this time.
0 commit comments