This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cyber-narrator-cn-ui/.gitlab-ci.yml
2021-06-25 09:40:11 +08:00

63 lines
1.5 KiB
YAML

stages:
- gen_git-log
- build_project
- build_image
cache:
key:
files:
- package.json
paths:
- node_modules
before_script:
- export UI_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:#000;" target="_blank" href="./git-log.html">更新记录</a>' ./public/index.html; echo "添加更新记录链接"; fi;
- echo "最近的100个提交记录"
- echo "<pre>" > ./public/git-log.html
- "git log -100 --pretty=format:'%ad : %s' >> ./public/git-log.html"
- echo "</pre>" >> ./public/git-log.html
- echo "处理 git-log.html 结束"
artifacts:
paths:
- public
only:
- dev-cicd
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-cicd
tags:
- GN-XXG-Server
build_image:
stage: build_image
script:
- echo "docker build"
- sudo docker build -t dev_cn-ui:$UI_TAG .
- echo "docker tag"
- sudo docker tag dev_cn-ui:$UI_TAG 192.168.40.153:9080/test/dev_cn-ui:$UI_TAG
- echo "docker push"
- sudo docker push 192.168.40.153:9080/test/dev_cn-ui:$UI_TAG
when: on_success
only:
- dev-cicd
tags:
- GN-XXG-Server