This repository was archived by the owner on Dec 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +59
-0
lines changed
Expand file tree Collapse file tree 1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change 1+ # Version tags only
2+
3+ name : Publish
4+
5+ on :
6+ push :
7+ tags :
8+ - v[0-9]+.[0-9]+.[0-9]+
9+
10+ env :
11+ NODE_VERSION : 18
12+
13+ jobs :
14+ npmPublish :
15+ name : Publish to npm
16+ runs-on : ubuntu-latest
17+
18+ env :
19+ # It'll work with secrets.GITHUB_TOKEN (which is provided by GitHub unconditionally)
20+ # Still then release author would be "github-actions". It's better if it's dedicated repo bot
21+ GITHUB_TOKEN : ${{ secrets.USER_GITHUB_TOKEN }}
22+
23+ steps :
24+ - name : Checkout repository
25+ uses : actions/checkout@v3
26+
27+ - name : Retrieve dependencies from cache
28+ id : cacheNpm
29+ uses : actions/cache@v3
30+ with :
31+ path : |
32+ ~/.npm
33+ node_modules
34+ key : npm-v${{ env.NODE_VERSION }}-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
35+
36+ - name : Install Node.js and npm
37+ uses : actions/setup-node@v3
38+ with :
39+ node-version : ${{ env.NODE_VERSION }}
40+ registry-url : https://registry.npmjs.org
41+
42+ - name : Install dependencies
43+ if : steps.cacheNpm.outputs.cache-hit != 'true'
44+ run : |
45+ npm ci
46+
47+ - name : Publish new version
48+ # Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
49+ # as it appears actions/setup-node sets own value
50+ env :
51+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
52+ run : npm publish
53+
54+ - name : Create and publish a release
55+ uses : softprops/action-gh-release@v1
56+ with :
57+ tag_name : ${GITHUB_REF##*/}
58+ prerelease : false
59+ generate_release_notes : true
You can’t perform that action at this time.
0 commit comments