-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
93 lines (86 loc) · 2.03 KB
/
.gitlab-ci.yml
File metadata and controls
93 lines (86 loc) · 2.03 KB
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
89
90
91
92
93
image: alpine:latest
stages:
- jsonnet
- plantuml
- deploy
- release
# Jsonnet
jsonnet:
stage: jsonnet
image:
name: bitnami/jsonnet:latest
entrypoint: [""]
script:
- SVC=idm && jsonnet -J templates $SVC/$SVC.jsonnet -S -m $SVC
artifacts:
paths:
- ./
interruptible: true
## PLANTUML
### build on changes, then cache artifacts
plantuml:
stage: plantuml
image: ubuntu:18.04
dependencies:
- jsonnet
cache:
key: "$CI_BUILD_REF_NAME"
paths:
- public
script:
- apt-get update -qq 2>&1 >/dev/null && apt-get install -qq -y --no-install-recommends zip jq git openjdk-8-jdk graphviz 2>&1 >/dev/null
- ./scripts/plantuml-header-patcher.sh
- ./scripts/plantuml-build.sh
interruptible: true
artifacts:
paths:
- public
# only:
# changes:
# - "**/*.puml"
### skip build plantuml if cache exist, otherwise run build
#plantuml-ensure-artifact-exists:
# extends: plantuml
# before_script:
# - '[[ -d public ]] && exit 0'
# only:
# except:
# changes:
# - "**/*.puml"
## GitLab Pages
pages:
stage: deploy
image:
name: alpine/git:latest
entrypoint: [""]
dependencies:
- plantuml
cache:
key: "$CI_BUILD_REF_NAME"
paths:
- public
script:
- '[[ ! -d "public/" ]] && exit 1' # If no public/ then exit error because the site need plantuml to be compiled before deploy
- apk add bash
# - '[[ ! -d "public/" ]] && (set +e && wget https://gitlab.com/nghinhut/docs/-/jobs/artifacts/master/download?job=pages -O artifacts.zip; unzip artifacts.zip; rm -f artifacts.zip && set -e)'
- export HUGO_BASEURL=$CI_PAGES_URL
- cat ./scripts/hugo-build.sh | bash
interruptible: true
artifacts:
paths:
- public
only:
- master
## RELEASE
release:
stage: release
image: node:10-alpine
cache:
paths:
- node_modules/
script:
- apk update && apk add git
- npm install -g semantic-release @semantic-release/gitlab
- semantic-release -r git@gitlab.com:nghinhut/docs.git
only:
- schedules