-
Notifications
You must be signed in to change notification settings - Fork 507
/
.gitlab-ci.yml
78 lines (71 loc) · 1.8 KB
/
.gitlab-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
before_script:
- nvm use 12.13.0
- node -v
stages:
- clean
- build_admin
- build_server
- build_main
clean1:
stage: clean
only:
- prod
script:
- cd /home/wwwroot/nav.geekape.net/
- rm -rf web server admin
- pm2 stop all
- pm2 delete all
- echo "清空nav.geekape.net目录成功"
allow_failure: true
#打包admin
build_admin:
stage: build_admin
only:
- prod
script:
# 将镜像源设置成淘宝镜像
- yarn config set registry 'https://registry.npm.taobao.org'
- cd geekape-nav-admin
- tyarn install
- echo "admin安装完成"
- yarn build
- echo "admin打包完成"
- mv dist admin
- mv admin/ /home/wwwroot/nav.geekape.net/
- echo "admin移动目录完成"
allow_failure: true
#打包server
build_server:
stage: build_server
only:
- prod
script:
- mv geekape-nav-server/ /home/wwwroot/nav.geekape.net/
- echo "server移动目录完成"
- cd /home/wwwroot/nav.geekape.net/
- mv geekape-nav-server server
- cd server/
- tyarn install
- echo "server包安装完成"
- rm -rf /home/wwwroot/nav.geekape.net/server/config/mongodb.ts
- cp /home/wwwroot/nav.geekape.net/mongodb.ts /home/wwwroot/nav.geekape.net/server/config/
- pm2 start npm --name "geekape-nav-server" -- run server
- echo "pm2 server启动成功"
allow_failure: true
#打包main
build_main:
stage: build_main
only:
- prod
script:
- mv geekape-nav-main/ /home/wwwroot/nav.geekape.net/
- cd /home/wwwroot/nav.geekape.net/
- mv geekape-nav-main web
- cd web/
- tyarn install
- echo "main包安装完成"
- yarn build
- echo "main打包完成,可以运行"
- pm2 start npm --name "geekape-nav-main" -- run server
- echo "pm2 main启动成功"
allow_failure: true