-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci-example.yml
56 lines (48 loc) · 1.2 KB
/
.gitlab-ci-example.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
# gitlab-ci 样例文件,只加了很简单的任务
## 使用方式:将本文件改名为 gitlab-ci.yml 即可
## 官方文档:
## https://gitlab.com/help/ci/quick_start/README
##
# 给node_modules设置缓存,这样就不用每次重新安装依赖,加快速度。
cache:
paths:
- node_modules/
# 在开始跑脚本之前,需要设置环境变量。主要为暴露一些必须的命令。
before_script:
- export PATH=$PATH:/usr/local/bin
- export PATH=$PATH:/usr/bin
# 结束之后清理工作
# after_script:
# - npm run clear
stages:
- test
- deploy # 这里合并了 build 和 deploy
- release
# 每次提交都需要跑一次基准 test,以保证当次提交不会导致 App crash
test:
stage: test
script:
- yarn install ## 安装依赖
- yarn test
deploy_dev:
stage: deploy
script:
- your dev build script here
- your deploy script here
only:
- dev
deploy_pre:
stage: deploy
script:
- your pre-production build script here
- your deploy script here
only:
- dev
deploy_prd:
stage: release
script:
- your production build script here
- your deploy script here
when: manual # 手动,不能轻易部署
only:
- master