-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
71 lines (67 loc) · 2.21 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
stages:
- build
- test
- deploy
.before-script: &before-script
- "sed -i 's~server: https:\/\/plantuml.cyber.ee~server: http:\/\/plantuml:8080~g' cdoc2-system-docs/mkdocs.yml"
build-image:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.22.0-debug
entrypoint: [""]
script:
- |
/kaniko/executor \
--context $CI_PROJECT_DIR \
--build-arg http_proxy=$http_proxy \
--build-arg https_proxy=$https_proxy \
--dockerfile $CI_PROJECT_DIR/Dockerfile \
--destination $CI_REGISTRY_IMAGE:latest \
--cache
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
changes:
- Dockerfile
- mkdocs_requirements.txt
- nvm-install.sh
test:
stage: test
image: $CI_REGISTRY_IMAGE
services:
- name: plantuml/plantuml-server
alias: plantuml
script:
- *before-script
- markdownlint-cli2 "cdoc2-system-docs/**/*.md"
- cd cdoc2-system-docs && mike deploy $DOC_VERSION --ignore-remote-status
rules:
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH'
changes:
- cdoc2-system-docs/**/*
when: always
allow_failure: true
deploy:
stage: deploy
image: $CI_REGISTRY_IMAGE
services:
- name: plantuml/plantuml-server
alias: plantuml
before_script:
- *before-script
- mkdir ~/.ssh && cp "${GITLAB_CI_KNOWN_HOSTS}" ~/.ssh/known_hosts && cp "${GITLAB_CI_SSH_PRIVATE}" ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
- git config user.name "${GIT_COMMITTER_NAME}"
- git config user.email "${GIT_COMMITTER_EMAIL}"
script:
# to export DOC_VERSION in a format of x.y.z
- export DOC_VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//')
- git branch -D gh-pages || true
- git remote rm cyber || true
- git remote add cyber $CDOC2_DOCUMENTATION_GIT || true
- git fetch cyber gh-pages:gh-pages || true
- mike deploy -F cdoc2-system-docs/mkdocs.yml -r cyber --deploy-prefix docs --branch gh-pages --push $DOC_VERSION --ignore-remote-status
- mike set-default -F cdoc2-system-docs/mkdocs.yml -r cyber --deploy-prefix docs --branch gh-pages --push $DOC_DEFAULT_VERSION --ignore-remote-status
rules:
- if: '$CI_COMMIT_TAG =~ /^v/'
when: always
- when: never