blob: e6a1690af9a1d8d360056176f4e85ea65d5286b9 (
plain)
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
|
# docker镜像
image: git.mesalab.cn:7443/nezha/nz-build-env:dh-gui
# 定义全局变量
variables:
MINIO_HOST: 'http://192.168.40.48:2020/'
MINIO_USER: 'admin'
MINIO_PWD: "Nezha@02!"
# 依赖的docker服务
# services:
# - mariadb
# - redis
# 开始执行脚本前所需执行脚本
before_script:
- echo "begin ci"
# 脚本执行完后的钩子,执行所需脚本
after_script:
- echo "end ci"
# 该ci pipeline适合的场景
stages:
- build
- test
cache:
paths:
- /builds/appsketch-works/asw-gui/node_modules/
# dev 分支
dev_build:
# 所需执行的脚本
script:
- env | sort
- pwd
# 安装 npm 依赖文件
# npm install
- echo "npm install ..."
- npm install --registry=http://registry.npmmirror.com
# npm run build
- echo "npm run build"
- npm run build
# /builds/appsketch-works/asw-gui
- cd /builds/appsketch-works/asw-gui/dist
- export FILE_NAME=asw-gui-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA.zip
# 生成 git log 日志文件
#- sed -i 's+</body>+<a style="position:fixed;bottom:20px;left:40px;z-index:999;" target="_blank" href="/static/git-log.html">更新记录</a>\n</body>+g' ./index.html;
#- "git log -100 --pretty=format:'%ad : %s' >> ./static/gui-log.html"
- zip -q -r $FILE_NAME ./*
# 将 dist zip 上传到 minio
- md5sum $FILE_NAME > asw-gui-$CI_COMMIT_REF_NAME-latest.zip.md5sum.txt
- mc alias set asw $MINIO_HOST $MINIO_USER $MINIO_PWD
- mc cp $FILE_NAME asw/ci-cd/asw-gui/$FILE_NAME
- mc cp $FILE_NAME asw/ci-cd/asw-gui/asw-gui-$CI_COMMIT_REF_NAME-latest.zip
- mc cp asw-gui-$CI_COMMIT_REF_NAME-latest.zip.md5sum.txt asw/ci-cd/asw-gui/asw-gui-$CI_COMMIT_REF_NAME-latest.zip.md5sum.txt
artifacts:
name: "asw-gui-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA"
when: on_success
paths:
- /builds/appsketch-works/asw-gui/dist/asw-gui*.zip
expire_in: 1 day
# 在哪个分支上可用
only:
- /^dev-.*$/i
# 指定哪个ci runner跑该工作
tags:
- asw
# release build
rel_build:
stage: build
script:
- env | sort
- pwd
- echo "npm install ..."
- npm install --registry=http://registry.npmmirror.com
# npm run build
- echo "npm run build"
- npm run build
- cd /builds/appsketch-works/asw-gui/dist
- export FILE_NAME=asw-gui-$CI_COMMIT_SHORT_SHA.zip
- zip -q -r $FILE_NAME ./*
- md5sum asw-gui-$CI_COMMIT_SHORT_SHA.zip > asw-gui-$CI_COMMIT_SHORT_SHA.zip.md5sum.txt
- mc alias set asw $MINIO_HOST $MINIO_USER $MINIO_PWD
- mc cp asw-gui-$CI_COMMIT_SHORT_SHA.zip asw/release/asw-gui/asw-gui-$CI_COMMIT_SHORT_SHA.zip
- mc cp asw-gui-$CI_COMMIT_SHORT_SHA.zip.md5sum.txt asw/release/asw-gui/asw-gui-$CI_COMMIT_SHORT_SHA.zip.md5sum.txt
artifacts:
name: "asw-gui-$CI_COMMIT_SHORT_SHA"
when: on_success
paths:
- /builds/appsketch-works/asw-gui/dist/asw-gui-$CI_COMMIT_SHORT_SHA.zip
expire_in: 1 week
# 在哪个分支上可用
only:
- /^rel-.*$/i
# 指定哪个ci runner跑该工作
tags:
- asw
|