-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdocs.sh
executable file
·57 lines (45 loc) · 2.03 KB
/
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
#!/bin/bash
# Insall gh-pages-multi
npm i -g @koumoul/gh-pages-multi
export PROJECT="camunda-ext"
export VERSION=
if [[ "x$TRAVIS_TAG" != "x" ]]; then
export VERSION="$TRAVIS_TAG"
fi
if [[ "$TRAVIS_BRANCH" == "master" ]]; then
export VERSION=latest
fi
# Generate docs
mvn compile groovydoc:generate com.bluetrainsoftware.maven:groovydoc-maven-plugin:2.1:attach-docs $@
# Generate docs for kotlin
mvn org.jetbrains.dokka:dokka-maven-plugin:dokka
# If this is a Travis build, use Github Pages relative urls /camunda-ext/version
# Otherwise use just /camunda-ext without version,
# In most cases you use latest commit in branch like master (=unreleased version, e.g. 1.5), and version from just pom.xml (1.4) is not consistent with that
if [[ "x$VERSION" != "x" ]]; then
export DOC_BASE_URL="/$PROJECT/$VERSION"
else
export DOC_BASE_URL="/$PROJECT"
fi
# Remove docs generation datetime
# And replace $docBaseUrl in doc urls
unamestr=`uname`
if [[ "$unamestr" == "Linux" ]]; then
find docs -type f -name "*.html" -exec sed -i -E "/<!-- Generated by groovydoc .* -->/d" {} ';'
find docs -type f -name "*.html" -exec sed -i -E "/<meta name=\"date\" content=/d" {} ';'
find docs -type f -name "*.html" -exec sed -i -E "s#\\$\{docBaseUrl\}#$DOC_BASE_URL#g" {} ';'
else
find docs -type f -name "*.html" -exec ex -sc "g/<!-- Generated by groovydoc .* -->/d" -cx {} ';'
find docs -type f -name "*.html" -exec ex -sc "g/<meta name=\"date\" content=/d" -cx {} ';'
find docs -type f -name "*.html" -exec ex -sc "s#\\$\{docBaseUrl\}#$DOC_BASE_URL#g" -cx {} ';'
fi
# Push docs into separated dirs in gh-pages repo
if [[ "x$VERSION" != "x" ]]; then
git remote remove origin
git remote add origin https://${GITHUB_TOKEN}@github.com/$TRAVIS_REPO_SLUG.git > /dev/null 2>&1
gh-pages-multi deploy --no-history -t $VERSION
fi
# Push kotlin docs
mv kotlin-docs/style.css kotlin-docs/bss/style.css
find kotlin-docs -type f -name "*.html" -exec sed -i '' -e 's!..\/style.css!style.css!' {} ';'
gh-pages-multi deploy --no-history -s kotlin-docs/bss -t "kotlin-${VERSION}"