forked from redhat-scholars/istio-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 6
/
.travis.yml
44 lines (39 loc) · 1.6 KB
/
.travis.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
sudo: required
services:
- docker
addons:
apt:
sources:
- git-core
packages:
- git
language: java
jdk:
- oraclejdk11
before_install:
- BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- '[ $(git log --format=%B $TRAVIS_COMMIT_RANGE | grep -i "#doc" | wc -l) -gt 0 ] && FORCE_DOC_GEN=0 || FORCE_DOC_GEN=1'
- MODIFIED_DOCS=$(git diff --name-only $TRAVIS_COMMIT_RANGE | grep -E 'site-*|README.adoc|^documentation/.*.adoc$' | wc -l)
- '[ $BRANCH == "master" ] && [ $MODIFIED_DOCS -ge 1 ] && GENERATE_DOC=0 || GENERATE_DOC=1'
- 'if [ $FORCE_DOC_GEN == 0 ] || [ $GENERATE_DOC == 0 ]; then
git config user.name "${GH_USER}";
git config user.email "${GH_EMAIL}";
git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*;
git fetch --unshallow origin gh-pages;
git worktree add -b gh-pages gh-pages origin/gh-pages;
GH_REF=$(git remote get-url origin | awk "{sub(/https:\/\//,\"https://${GH_TOKEN}@\")}; 1" | awk "{sub(/\.git/, \"\")} 1");
docker pull antora/antora:2.0.0;
fi'
script:
- 'if [ $FORCE_DOC_GEN == 0 ] || [ $GENERATE_DOC == 0 ]; then
docker run -v $TRAVIS_BUILD_DIR:/antora --rm -t antora/antora:2.0.0 --pull --stacktrace site-workshop.yml;
docker run -v $TRAVIS_BUILD_DIR:/antora --rm -t antora/antora:2.0.0 --pull --stacktrace site-gh-pages.yml;
fi'
after_success:
- 'if [ $FORCE_DOC_GEN == 0 ] || [ $GENERATE_DOC == 0 ]; then
cd gh-pages;
touch .nojekyll;
git add .;
git commit -m "Publishes new documentation";
git push --quiet "${GH_REF}" gh-pages > /dev/null 2>&1;
fi'