Skip to content

Commit 873d057

Browse files
committed
add workflows
1 parent e56a46d commit 873d057

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish to NPM
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: '18.x'
15+
registry-url: 'https://registry.npmjs.org'
16+
17+
- name: Install dependencies
18+
run: npm ci
19+
20+
- name: Build
21+
run: npm run build
22+
23+
- name: Run tests
24+
run: npm test -- --no-watch
25+
26+
publish-npm:
27+
needs: build
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: actions/setup-node@v3
32+
with:
33+
node-version: '18.x'
34+
registry-url: 'https://registry.npmjs.org'
35+
36+
- name: Install dependencies
37+
run: npm ci
38+
39+
- name: Build
40+
run: npm run build
41+
42+
- name: Publish to NPM
43+
run: npm publish
44+
env:
45+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/unit-tests.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Unit Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: '18.x'
19+
cache: 'npm'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Run linting
25+
run: npm run lint
26+
27+
- name: Run unit tests
28+
run: npm test -- --no-watch
29+
30+
- name: Build
31+
run: npm run build

0 commit comments

Comments
 (0)