forked from MingweiSamuel/muni-sign
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (83 loc) · 2.62 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
84
85
86
87
88
89
90
91
92
93
94
95
96
on:
push:
pull_request:
schedule:
- cron: "49 05 * * *" # Daily at 10:49 PM PDT, 10:49 PM PST.
workflow_dispatch:
name: CI
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v3.4.0
with:
cancel_others: 'true'
check:
name: Check
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Node packages
run: npm ci
- name: Check
run: npm run check
build:
name: Build
needs: pre_job
if: ${{ needs.pre_job.outputs.should_skip != 'true' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
timeout-minutes: 5
env:
WWW_DIR: dist
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install Node packages
run: npm ci
- name: Install q CLI
run: |
wget -O ./q.deb https://github.com/harelba/q/releases/download/v3.1.6/q-text-as-data-3.1.6-1.x86_64.deb
sudo apt install ./q.deb
- name: Build
run: npm run build
- name: Deploy to gh-pages
if: ${{ github.event_name != 'pull_request' }}
shell: bash
run: |
cp -r .github/gh-pages/. "$WWW_DIR/"
git -C "$WWW_DIR" init -q
git -C "$WWW_DIR" remote add origin "$(git remote get-url origin)"
git -C "$WWW_DIR" config credential.helper "$(git config credential.helper)"
git -C "$WWW_DIR" config 'http.https://github.com/.extraheader' "$(git config 'http.https://github.com/.extraheader')"
git -C "$WWW_DIR" config core.autocrlf input
git -C "$WWW_DIR" config core.safecrlf false
git -C "$WWW_DIR" fetch origin gh-pages:gh-pages || true
git -C "$WWW_DIR" symbolic-ref HEAD refs/heads/gh-pages
git -C "$WWW_DIR" reset
git -C "$WWW_DIR" add -A
if git -C "$WWW_DIR" -c 'user.name=github-actions[bot]' -c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \
commit -m "Build site $(date -I) $(git rev-parse HEAD)";
then
git -C "$WWW_DIR" push -u origin gh-pages --quiet
else
echo 'No changes to commit'
fi