File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 2222 make_latest : true
2323 env :
2424 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25+
26+ npm-publish :
27+ needs : github-release
28+ runs-on : ubuntu-latest
29+ steps :
30+ - name : Checkout
31+ uses : actions/checkout@v4
32+
33+ - name : Setup Node.js
34+ uses : actions/setup-node@v4
35+ with :
36+ node-version : ' 18'
37+ registry-url : ' https://registry.npmjs.org'
38+
39+ - name : Install dependencies
40+ run : npm install
41+
42+ - name : Build package
43+ run : npm run build
44+
45+ - name : Update package version
46+ run : |
47+ TAG_VERSION=${GITHUB_REF#refs/tags/v}
48+ CURRENT_VERSION=$(node -p "require('./package.json').version")
49+ if [ "$TAG_VERSION" != "$CURRENT_VERSION" ]; then
50+ npm version $TAG_VERSION --no-git-tag-version
51+ else
52+ echo "Version already matches tag version $TAG_VERSION, skipping npm version"
53+ fi
54+
55+ - name : Publish to NPM
56+ run : npm publish --access public
57+ env :
58+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments