63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
stages:
|
|
- gen_git-log
|
|
- build_project
|
|
- build_image
|
|
|
|
cache:
|
|
key:
|
|
files:
|
|
- package.json
|
|
paths:
|
|
- node_modules
|
|
|
|
before_script:
|
|
- export CNUI_TAG=$(date +%Y%m%d%H%M%S)
|
|
|
|
generate_git-log:
|
|
stage: gen_git-log
|
|
script:
|
|
- if (( `grep git-log.html ./public/index.html | wc -l` == 0 )); then sed -i '/<body>/ a <a style="position:fixed;bottom:20px;left:40px;z-index:999;color:white;" target="_blank" href="./git-log.html">更新记录</a>' ./public/index.html; echo "添加更新记录链接"; fi;
|
|
- echo "最近的100个提交记录"
|
|
- echo "<!DOCTYPE html><html><head><meta charset='utf-8'></head><body><pre>" > ./public/git-log.html
|
|
- "git log -100 --pretty=format:'%ad : %s' >> ./public/git-log.html"
|
|
- echo "</pre></body></html>" >> ./public/git-log.html
|
|
- echo "处理 git-log.html 结束"
|
|
artifacts:
|
|
paths:
|
|
- public
|
|
only:
|
|
- dev
|
|
tags:
|
|
- GN-XXG-Server
|
|
|
|
build_project:
|
|
stage: build_project
|
|
script:
|
|
- echo "npm install ..."
|
|
- npm install --unsafe-perm
|
|
- echo "npm run build"
|
|
- npm run build
|
|
artifacts:
|
|
paths:
|
|
- dist
|
|
only:
|
|
- dev
|
|
tags:
|
|
- GN-XXG-Server
|
|
|
|
build_image:
|
|
stage: build_image
|
|
script:
|
|
- echo "docker build"
|
|
- sudo docker build -t dev_cn-ui:$CNUI_TAG .
|
|
- echo "docker tag"
|
|
- sudo docker tag dev_cn-ui:$CNUI_TAG 192.168.40.153:9080/cyber-narrator/dev_cn-ui:$CNUI_TAG
|
|
- echo "docker push"
|
|
- sudo docker push 192.168.40.153:9080/cyber-narrator/dev_cn-ui:$CNUI_TAG
|
|
when: on_success
|
|
only:
|
|
- dev
|
|
tags:
|
|
- GN-XXG-Server
|
|
|