-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (54 loc) · 1.45 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# This workflow will do a clean install of node dependencies, run npm lint, build the source code and run tests.
name: Build, test and publish API docs
on:
push:
branches: [ main ]
pull_request:
branches: [ '**' ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '18.3.0'
- name: NPM install
run: npm ci
- name: Run linter
run: npm run lint
- name: Build library
run: npm run build --if-present
- name: Unit tests
run: npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
- name: Archive production artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: npm-logs
path: |
/home/runner/.npm/_logs
publish-api-docs:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
steps:
- name: Check out
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '18.3.0'
- name: NPM install
run: npm ci
- name: Generate API docs
run: npm run doc
- name: Publish API docs to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.ACCESS_TOKEN }}
publish_dir: ./docs