Skip to content

Commit e196fb3

Browse files
committed
add gh actions build
1 parent 1fae1a9 commit e196fb3

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/commit_gate.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Commit Gate
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: checkout code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '20' # Or any other version you need
22+
23+
- name: Install dependencies
24+
run: npm ci --prefix src/
25+
26+
- name: Build
27+
run: npm run build --prefix src/
28+
29+
- name: Install test dependencies
30+
run: npm ci --prefix tests/
31+
32+
- name: Run tests
33+
run: npm run test --prefix tests/

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish npm package
2+
3+
on:
4+
push:
5+
tags: v*
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
15+
steps:
16+
- name: checkout code
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: '20'
23+
registry-url: 'https://registry.npmjs.org'
24+
25+
- name: Create npm package
26+
run: |
27+
cd src
28+
npm version ${{ steps.get_version.outputs.version_number }}
29+
npm pack
30+
31+
- name: Publish package
32+
run: |
33+
cd src
34+
npm publish --provenance --access public
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

src/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.1",
44
"type": "module",
55
"description": "Validates relations within one or multiple JSON files, such as key, keyref, uniqueness",
6+
"repository": "https://github.com/shuebner/json_keyref",
67
"main": "./built/index.js",
78
"bin": {
89
"json-keyref": "built/index.js"

0 commit comments

Comments
 (0)