-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (62 loc) · 1.94 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
69
70
71
72
73
74
75
76
77
name: build
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
strategy:
matrix:
node-version: [13.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get npm cache directory path
id: npm-cache-dir-path
run: echo "::set-output name=dir::$(npm config get cache)"
- name: Cache npm modules
uses: actions/cache@v1
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm
- name: Install
run: npm ci
- name: Prettier check
run: npm run format:check
- name: Build
run: npm run build
- name: Test
run: npm test
- name: Deploy
if: github.ref == 'refs/heads/master'
# https://github.com/peaceiris/actions-gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
force_orphan: true
disable_nojekyll: true
- name: Pack
id: pack-npm
run: echo "::set-output name=filename::$(npm pack | tail -1)"
- name: Unpack
run: tar -xvzf $filename
env:
filename: ${{ steps.pack-npm.outputs.filename }}
- name: Deploy nightly
if: github.ref == 'refs/heads/master'
# https://github.com/peaceiris/actions-gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./package
force_orphan: true
publish_branch: nightly
disable_nojekyll: true