-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
105 lines (97 loc) · 2.62 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
image: node:14
variables:
GIT_STRATEGY: fetch
GIT_CLEAN_FLAGS: -ffdx -e .cache_yarn -e .next -e node_modules -e yarn.lock -e .env
stages:
- install
- build
- test
- deploy
install_node_modules:
stage: install
script:
- yarn install --cache-folder .cache_yarn
- rm -rf node_modules/@pancakeswap/uikit .next && cp -r packages/uikit node_modules/@pancakeswap
only:
- develop
- production
tags:
- local
build_frontend:
stage: build
script:
- cp .env.development .env.production
- yarn build
only:
- develop
- master
dependencies:
- install_node_modules
tags:
- local
test_client:
stage: test
script:
- echo "Run test..."
only:
- develop
- master
dependencies:
- install_node_modules
tags:
- local
deploy_all_develop:
stage: deploy
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
- scp -o StrictHostKeyChecking=no -r .next [email protected]:~/dex-savvy-fe/
- scp -o StrictHostKeyChecking=no -r .env [email protected]:~/dex-savvy-fe/
- scp -o StrictHostKeyChecking=no -r public [email protected]:~/dex-savvy-fe/
- ssh -tt -o StrictHostKeyChecking=no [email protected] "cd dex-savvy-fe && git pull && yarn install && pm2 reload dex && exit"
only:
- develop
environment:
name: staging
dependencies:
- install_node_modules
- build_frontend
tags:
- local
build_frontend_production:
stage: build
script:
- cp .env.example.production .env.production
- yarn build
only:
- savvydex-v1
dependencies:
- install_node_modules
tags:
- local
deploy_all_production:
stage: deploy
before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
- tar cvzf next.tar.gz .next
- scp -o StrictHostKeyChecking=no next.tar.gz [email protected]:/opt/dex/dex-savvy-fe/
- scp -o StrictHostKeyChecking=no -r .env [email protected]:/opt/dex/dex-savvy-fe/
- ssh -tt -o StrictHostKeyChecking=no [email protected] "cd /opt/dex/dex-savvy-fe/ && tar -xvzf next.tar.gz && git pull && yarn install && pm2 reload dex && exit"
only:
- savvydex-v1
environment:
name: production
dependencies:
- install_node_modules
- build_frontend_production
tags:
- local