forked from devopskube/devopskube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-docs.sh
executable file
·80 lines (71 loc) · 1.46 KB
/
build-docs.sh
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
#!/bin/bash
#
# We are generating the documentation from given markdown-files using mkdoc (see
# http://www.mkdocs.org/).
# To be able to components in their corresponding helm-charts directory, we are
# copying the README.md files out of these directories into the components-directory.
#
MKDOC_COMP_PATH=docs/components
echo "Going to Build documentation..."
while [[ $# -gt 0 ]]
do
key="$1"
echo "KEY: $key"
case $key in
-b|--build)
COPY=true
BUILD=true
shift
;;
-c|--copy)
COPY=true
shift
;;
-d|--deploy)
CLEAN=true
COPY=true
BUILD=true
DEPLOY=true
shift
;;
-s|--serve)
echo "Serving Documentation"
CLEAN=true
COPY=true
BUILD=true
SERVE=true
shift
;;
-cl|--clean)
CLEAN=true
shift
;;
*)
echo "-b|-c|-d|-s|-cl"
# unknown option
;;
esac
shift
done
if [[ "$CLEAN" ]]; then
echo "Cleaning generated Content"
pushd docs/components
rm -f *.md
popd
fi
if [[ "$COPY" ]]; then
echo "Copying Component READMEs"
find charts -maxdepth 2 -type f -name "README.md" -print0 | while read -d $'\0' readme
do
cp $readme $MKDOC_COMP_PATH/$(basename $(dirname $readme)).md
done
fi
if [[ "$BUILD" ]]; then
mkdocs build --clean
fi
if [[ "$DEPLOY" ]]; then
mkdocs gh-deploy --clean
fi
if [[ "$SERVE" ]]; then
mkdocs serve
fi