-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
51 lines (48 loc) · 1.52 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
stages:
- build
- deploy
build:
image: node:14
stage: build
before_script:
- npm config set registry=https://registry.npm.taobao.org
- npm install -D vuepress
script:
- echo "==== docs build ===="
- npm run build
cache:
paths:
- node_modules/ # Node modules and dependencies
artifacts:
name: "artifacts_$CI_COMMIT_REF_NAME_$CI_COMMIT_SHORT_SHA"
expire_in: 3 day
paths:
- docs/.vuepress/dist
deploy_to_test:
image: alpine
stage: deploy
before_script:
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
script:
- echo "==== docs deploy ===="
- apk add --no-cache rsync openssh
- mkdir -p ~/.ssh
- echo "$TEST_SSH_PRIVATE_KEY" >> ~/.ssh/id_dsa
- chmod 600 ~/.ssh/id_dsa
- echo -e "Host 10.2.3.211\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- rsync -rav -e 'ssh -p 36000' --exclude ".user.ini" --delete docs/.vuepress/dist/ [email protected]:/www/wwwroot/docs/
deploy_to_product:
image: alpine
stage: deploy
before_script:
- sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
script:
- echo "==== docs deploy ===="
- apk add --no-cache rsync openssh
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" >> ~/.ssh/id_dsa
- chmod 600 ~/.ssh/id_dsa
- echo -e "Host $DEPLOY_HOST\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- rsync -rav -e 'ssh -p 36000' --delete docs/.vuepress/dist/ $DEPLOY_USER@$DEPLOY_HOST:/data/app/docs/
only:
- master