Skip to content

Commit f1e158b

Browse files
committed
chore: setup npm publish workflow
1 parent ad926fb commit f1e158b

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish to npm
2+
3+
on: push
4+
5+
jobs:
6+
build-and-publish:
7+
name: Build and publish to npm
8+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: "20"
19+
registry-url: "https://registry.npmjs.org"
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run tests (build)
25+
run: npm test
26+
27+
- name: Publish to npm
28+
env:
29+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
run: npm publish --access public

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
],
5858
"scripts": {
5959
"build": "tsc && node ./dist/index.js",
60+
"test": "npm run build",
6061
"jsdoc": "jsdoc",
6162
"docgen": "tsc && yarn jsdoc ./dist -R \"./readme.md\" -P \"./package.json\" -t \"./node_modules/jaguarjs-jsdoc\" -d \"./docs\" -r",
6263
"example": "tsc && node ./tests/mtCaptcha.js"

0 commit comments

Comments
 (0)