-
Notifications
You must be signed in to change notification settings - Fork 593
61 lines (58 loc) · 1.9 KB
/
nodejs-ci.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
# Node.js CI workflow
name: Node.js CI
on: [push, pull_request, merge_group]
jobs:
build:
runs-on: ubuntu-latest
env:
IS_PUSH_MASTER: ${{ github.ref == 'refs/heads/master' }}
IS_PUSH_DEVELOP: ${{ github.ref == 'refs/heads/develop' }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run lint
run: yarn run lint
- name: Run tests
run: yarn run test-ci
- name: Build
run: |
rm -Rf ./build
yarn run build
- name: Prepare for deploy (if master or develop branch)
if: env.IS_PUSH_DEVELOP == 'true' || env.IS_PUSH_MASTER == 'true'
run: |
rm -Rf ./node_modules/*
yarn install --prod --frozen-lockfile
mkdir ./build/demo
cp -Rf node_modules ./build/demo
cp -Rf dist ./build/demo
cp -Rf decoders ./build/demo
cp -Rf tests/pacs/viewer.* ./build/demo
./resources/scripts/prep-deploy.sh -f build/demo/viewer.html
./resources/scripts/prep-deploy.sh -f build/demo/viewer.js
- name: Push to gh-pages (if master or develop branch)
if: env.IS_PUSH_DEVELOP == 'true' || env.IS_PUSH_MASTER == 'true'
run: |
DEPLOY_DIR=./demo/trunk
if ${{ env.IS_PUSH_MASTER }}; then
DEPLOY_DIR=./demo/stable
fi
ALL=/*
git config user.email [email protected]
git config user.name github-actions
git checkout .
git checkout gh-pages
rm -Rf $DEPLOY_DIR$ALL
cp -Rf ./build/demo/* $DEPLOY_DIR
git add -A $DEPLOY_DIR
git diff-index --quiet HEAD ||
git commit -m "CI run ${{ github.run_number }} pushed to gh-pages"
git push -fq origin gh-pages