-
Notifications
You must be signed in to change notification settings - Fork 50
85 lines (63 loc) · 2.26 KB
/
web-deploy.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
name: Web Deploy
on:
push:
branches: [ master ]
jobs:
build:
runs-on: [ self-hosted, gingkowriter ]
defaults:
run:
working-directory: client
strategy:
matrix:
node-version: [18.x]
steps:
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Checkout client
uses: actions/checkout@v3
with:
path: client
- name: Checkout server
uses: actions/checkout@v3
with:
repository: gingko/server
path: server
- name: Create data directory
run: mkdir -p ../data
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Copy client config.js file
run: cp $HOME/client.config.js $GITHUB_WORKSPACE/client/config.js
- name: Check client config.js file
run: node $GITHUB_WORKSPACE/client/config-check.js
- name: Copy client hidden-config.js file
run: cp $HOME/client.hidden-config.js $GITHUB_WORKSPACE/client/hidden-config.js
- name: Copy server config.js file
run: cp $HOME/server.config.js $GITHUB_WORKSPACE/server/config.js
- name: Check server config.js file
run: node $GITHUB_WORKSPACE/server/config-check.js
- name: Install Test Server Dependencies
run: cd ../server; npm i; npx tsc
- name: Stop Test Server
run: "pm2 stop --silent GingkoTest || :"
- name: Start Test Server
run: NODE_ENV=production DEBUG=cards PORT=8000 pm2 start ../server/dist/index.js --name GingkoTest
- run: bun i
- run: bun run newbuild
- name: Playwright e2e Tests
run: bun run test
- name: Cypress e2e Tests
run: bunx cypress run
- name: Stop Test Server
run: pm2 stop GingkoTest
- name: Copy Build Files
if: "!contains(github.event.head_commit.message, 'ci skip deploy')"
run: |
cp -r $GITHUB_WORKSPACE/client/web/* $HOME/production/client/web
cp -r $GITHUB_WORKSPACE/server/* $HOME/production/server
- name: Restart Production Server
if: "!contains(github.event.head_commit.message, 'ci skip deploy')"
run: pm2 restart GingkoProductionNew