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 '/
/ a 更新记录' ./public/index.html; echo "添加更新记录链接"; fi; - echo "最近的100个提交记录" - echo "" > ./public/git-log.html
- "git log -100 --pretty=format:'%ad : %s' >> ./public/git-log.html"
- echo "" >> ./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