Skip to content

Commit 1c0a9cd

Browse files
authored
Add GitHub actions to this project (#20)
1 parent b79b806 commit 1c0a9cd

3 files changed

Lines changed: 115 additions & 0 deletions

File tree

.github/workflows/nodejs.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
name: Node.js CI
3+
4+
on:
5+
push:
6+
branches: [ main ]
7+
pull_request:
8+
branches: [ main ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-20.04
13+
14+
strategy:
15+
matrix:
16+
node-version: ['14', '16']
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v2
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
- name: Build package
28+
run: yarn build
29+
- name: Run tests
30+
run: yarn test

.github/workflows/pre-release.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
name: Node.js Package Pre-Release
3+
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2
13+
- name: Use Node.js LTS
14+
uses: actions/setup-node@v2
15+
with:
16+
node-version: '14'
17+
- name: Install dependencies
18+
run: yarn install
19+
- name: Build package
20+
run: yarn build
21+
- name: Run tests
22+
run: yarn test
23+
24+
publish-npm:
25+
needs: build
26+
runs-on: ubuntu-20.04
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v2
30+
- name: Use Node.js LTS
31+
uses: actions/setup-node@v2
32+
with:
33+
node-version: '14'
34+
registry-url: https://registry.npmjs.org/
35+
- name: Install dependencies
36+
run: yarn install --frozen-lockfile
37+
- name: Build package
38+
run: yarn build
39+
- name: Publish
40+
run: npm publish --access=public
41+
env:
42+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/publish.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
name: Node.js Package
3+
4+
on:
5+
release:
6+
types: [created]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v2
14+
- name: Use Node.js LTS
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '14'
18+
- name: Install dependencies
19+
run: yarn install
20+
- name: Build package
21+
run: yarn build
22+
- name: Run tests
23+
run: yarn test
24+
25+
publish-npm:
26+
needs: build
27+
runs-on: ubuntu-20.04
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v2
31+
- name: Use Node.js LTS
32+
uses: actions/setup-node@v2
33+
with:
34+
node-version: '14'
35+
registry-url: https://registry.npmjs.org/
36+
- name: Install dependencies
37+
run: yarn install --frozen-lockfile
38+
- name: Build package
39+
run: yarn build
40+
- name: Publish
41+
run: yarn publish
42+
env:
43+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)