-
-
Notifications
You must be signed in to change notification settings - Fork 18
83 lines (71 loc) · 1.98 KB
/
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: ngx-ui-scroll ci
on:
pull_request:
push:
branches:
- 'master'
workflow_dispatch:
inputs:
cause:
description: 'Reason'
required: true
default: 'Manual triggering'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
steps:
- name: Dispatched?
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
echo "This is dispatched"
echo "Build reason: ${{ github.event.inputs.cause }}"
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm run ci:lib
- run: npm run build:lib
- run: npm run ci:demo
- run: npm run build:demo
- run: npm run ci:tests
- run: npm test
- uses: actions/upload-artifact@master
with:
name: demo-dist
path: dist/demo
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Set env BRANCH
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
- name: Set env NEED
run: |
if [[ $BRANCH == 'master' && $GITHUB_EVENT_NAME == 'push' ]]; then
echo "NEED=true" >> "$GITHUB_ENV"
else
echo "NEED=false" >> "$GITHUB_ENV"
fi
- name: Skip Deploy?
if: env.NEED != 'true'
run: echo "Only pushing to 'master' causes automatic deployment"
- name: Checkout
if: env.NEED == 'true'
uses: actions/checkout@v3
- name: Download dist
if: env.NEED == 'true'
uses: actions/download-artifact@master
with:
name: demo-dist
path: dist-demo-app
- name: Deploy
if: env.NEED == 'true'
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: dist-demo-app