Skip to content

Commit f199f7d

Browse files
committed
Setup npm release script
1 parent e0af8f0 commit f199f7d

File tree

3 files changed

+53
-6
lines changed

3 files changed

+53
-6
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
run: npm ci
2727

2828
- name: Install
29-
run: npm run test
29+
run: npm run test

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release on npm
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Lint and Test"]
6+
types:
7+
- completed
8+
branches:
9+
- main
10+
11+
jobs:
12+
deploy:
13+
permissions:
14+
contents: read
15+
id-token: write
16+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Setup node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
cache: npm
27+
28+
- name: Install
29+
run: npm ci
30+
31+
- name: Build
32+
run: npm run build
33+
34+
- id: publish
35+
name: Publish to NPM
36+
uses: JS-DevTools/npm-publish@v3
37+
with:
38+
token: ${{ secrets.NPM_TOKEN }}
39+
access: public
40+
provenance: true

package.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"name": "jsonpath-js",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "An implementation of JSONPath",
55
"author": "ashphy <[email protected]>",
66
"license": "MIT",
7-
"repository": "github:ashphy/jsonpath-js",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/ashphy/jsonpath-js.git"
10+
},
811
"exports": {
912
".": {
1013
"require": "./dist/index.js",
@@ -13,8 +16,8 @@
1316
}
1417
},
1518
"main": "dist/index.js",
16-
"module": "dist/esm/index.mjs",
17-
"types": "dist/esm/index.d.ts",
19+
"module": "dist/index.mjs",
20+
"types": "dist/index.d.ts",
1821
"engines": {
1922
"node": ">=18"
2023
},
@@ -24,6 +27,10 @@
2427
"README.md",
2528
"LICENSE"
2629
],
30+
"keywords": [
31+
"jsonpath",
32+
"json"
33+
],
2734
"scripts": {
2835
"build": "tsup ./src",
2936
"build:parser": "ts-node ./grammer/builder.ts",
@@ -52,4 +59,4 @@
5259
"dependencies": {
5360
"es-toolkit": "^1.27.0"
5461
}
55-
}
62+
}

0 commit comments

Comments
 (0)