-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
88 lines (83 loc) · 2.08 KB
/
.gitlab-ci.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
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
default:
tags:
- k8s
retry:
max: 2
when:
- runner_system_failure
- stuck_or_timeout_failure
- scheduler_failure
image:
name: release-ci.daocloud.io/product/ndx-mkdocs-material:3.1.3
entrypoint: [""]
before_script:
- cp -r /docs/. /builds/ndx/product/product-doc
- env
- pwd
- ls -al
- whoami
- ls /
stages:
- build_docs
- push_github
- build_images
pages:
variables:
GIT_SUBMODULE_STRATEGY: recursive # 拉取 Submodule 内容
stage: build_docs
only:
- master
script:
- apk add bash
- pip install mkdocs-monorepo-plugin jieba -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
- mkdocs build -f mkdocs-zh.yml -d public/ # build to public path
- mkdocs build -f mkdocs-en.yml -d public/en/ # build to public path
artifacts:
paths:
- public
expire_in: 1 week
cache:
key: build-cache
paths:
- public
images:
image: release-ci.daocloud.io/common-ci/common-ci-builder:v0.1.15
stage: build_images
cache:
key: build-cache
paths:
- public
services:
- docker:dind
before_script:
- docker -v
script:
- ls -al
- export REGISTRY_SERVER_ADDRESS="release-ci.daocloud.io"
- docker login -u ${REGISTRY_USER_NAME} -p ${REGISTRY_PASSWORD} ${REGISTRY_SERVER_ADDRESS}
- docker build -t release-ci.daocloud.io/product/dce5-docs:latest -f Dockerfile_images .
- docker push release-ci.daocloud.io/product/dce5-docs:latest
# Run this job in a branch where a Dockerfile exists
rules:
- if: $CI_COMMIT_BRANCH
exists:
- Dockerfile_images
github:
stage: push_github
cache:
key: build-cache
paths:
- public
before_script:
- git --version
script:
- cd public
- rm -rf .git
- echo "dce.samzong.me" > CNAME
- git init
- git config user.email [email protected]
- git remote add origin https://${GITHUB_TOKEN}@github.com/SAMZONG/demo-mutils-docs.git
- git branch -M gh-pages
- git add .
- git commit -m "update docs from gitlab ci"
- git push -f origin gh-pages