1- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3-
4- name : Node.js Package
5-
1+ name : release
62on :
7- release :
8- types : [created]
3+ push :
4+ branches :
5+ - main
6+ tags :
7+ - ' v*.*.*'
8+ pull_request :
9+ types :
10+ - labeled
911
1012jobs :
11- build :
13+ release :
14+ if : github.event.action != 'labeled'
1215 runs-on : ubuntu-latest
1316 steps :
1417 - uses : actions/checkout@v2
15- - uses : actions/setup-node@v2
18+ - name : Post bumpr status comment
19+ uses : haya14busa/action-bumpr@v1
20+
21+ # Get tag name.
22+ - id : tag
23+ uses : haya14busa/action-cond@v1
1624 with :
17- node-version : 12
18- - run : npm ci
25+ cond : " ${{ startsWith(github.ref, 'refs/tags/') }}"
26+ if_true : ${{ github.ref }}
27+ if_false : ${{ steps.bumpr.outputs.next_version }}
28+
29+ - name : Release
30+ uses : justincy/github-action-npm-release@2.0.2
31+ id : release
32+ - uses : actions/setup-node@v1
33+ if : steps.release.outputs.released == 'true'
34+ with :
35+ registry-url : ' https://registry.npmjs.org'
36+ - name : Publish
37+ if : steps.release.outputs.released == 'true'
38+ run : echo "//registry.npmjs.org/:_authToken=${{secrets.npm_token}}" > .npmrc && npm ci && npm publish
39+ env :
40+ NODE_AUTH_TOKEN : ${{ secrets.npm_token }}
41+
1942
20- publish-npm :
21- needs : build
43+ release-check :
44+ if : github.event.action == 'labeled'
2245 runs-on : ubuntu-latest
2346 steps :
2447 - uses : actions/checkout@v2
25- - uses : actions/setup-node@v2
26- with :
27- node-version : 12
28- registry-url : https://registry.npmjs.org/
29- - run : npm ci
30- - run : npm publish
31- env :
32- NODE_AUTH_TOKEN : ${{secrets.npm_token}}
48+ - name : Post bumpr status comment
49+ uses : haya14busa/action-bumpr@v1
0 commit comments