Skip to content

Commit 4234263

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

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
12+
steps:
13+
- name: checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '20' # Or any other version you need
20+
21+
- name: Create npm package
22+
run: |
23+
cd src
24+
npm version ${{ steps.get_version.outputs.version_number }}
25+
npm pack
26+
27+
- name: Publish package
28+
run: |
29+
cd src
30+
npm publish
31+
env:
32+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)