forked from devonfw/getting-started
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
80 lines (79 loc) · 4.05 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
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
language: generic
env:
global:
- ORG="devonfw"
- EMAIL="[email protected]"
- REPO_SOURCE="getting-started"
- REPO_DEST="getting-started.wiki"
- REPO_CONSOLIDATE="devonfw-guide"
- GH_REPO_SOURCE="github.com/${ORG}/${REPO_SOURCE}.git"
- GH_REPO_DEST="github.com/${ORG}/${REPO_DEST}.git"
- GH_REPO_CONSOLIDATE="github.com/${ORG}/${REPO_CONSOLIDATE}.git"
- secure: SjDW/60KC9qs9IdFc2KBj0Yx2lIJm08DwMEH/jehphl5LRJFLKj7jIL4kK2tDecOdwoiLpPwQQyzqXbo+5xQOCgOkNQ2PhhSmgv7PfP7D91yjqYA/6xQFBFCp7RyRfK/RqIcOma7vlpNzAJQvlCZnTyS5uAYW3IxTRRI/sk3sPs0aKFIR6u07z3IhUUs8XCFjhxBO3LR7nNMEoN1sN6pRYAtpVDXzMWjZ1y9VXPngc93QD4fmVNBRDeyxlG3K8ayjF5kNTb3UFac1M/hGsGRENXp88DPa1phBBLPp8sbLTcAZMa89GbKQsgii2pJ2uNITmHDTTz65HVHIGT5WdIztXF/PN50Xkzpmdx3/fB8ly5TnpkzF2juAJ8Ru2iKIKHv8kELmaoq99yZ0Hzalt4jKDT0NCYCuADVVv3HwzRl69rJ7ElxkI32ucltkjIPrecMkSCvQchrE9PWIi9LWVCsAQzGTA+yLvreKkmAHIkxyGFWrlu6K+kRnbTYuiI8hxdH/XM09IRhahpdi0GhdRT6x81kx1Dto0OD83kRRkMcWfKkpkYKgmsOu4WNwPfV5eDRN2WBT60qukTcRU1eYq2uaL5EqmRLsFSTnIFxMXRu5YDVzYDfZG074hiJLby/m/nreDZB25uOzuxiqSe8ZGqQkAeKgLKP5akRpiZ1QG5tNlU=
install: true
before_install:
- cd ..
- sudo apt-get update
- sudo apt-get install -y imagemagick
stages:
- name: Documentation
if: (branch = develop) AND (type = push)
jobs:
include:
- stage: Documentation
script:
# Clone necessary repositories
- git clone https://${GH_REPO_DEST}
- git clone https://${GH_REPO_CONSOLIDATE}
# Clean up wiki repository, copy documentation there
- cd ${REPO_DEST} && rm -rf * && cd ..
- yes | cp -rf ${REPO_SOURCE}/documentation/* ${REPO_DEST}/
- cd ${REPO_DEST}
# Remove .asciidoc file extension from relative links
- grep -lr "link:[a-zA-Z0-9_.-]*\.asciidoc\[" . | xargs -r sed -i "s/\(link:[a-zA-Z0-9_.-]*\)\.asciidoc\(\[\)/\1\2/g"
# Terminate Travis CI build when no changes detected
- |
if git diff-index --quiet HEAD && [ ! -n "$(git status -s)" ]; then
set +e
pkill -9 -P $$ &> /dev/null || true
exit 0
else
git config user.email ${EMAIL}
git config user.name ${USER}
git status
git add .
git commit -m "${REPO_SOURCE} documentation | Travis CI build number $TRAVIS_BUILD_NUMBER"
git remote add origin-wiki "https://${USER}:${GITHUB_TOKEN}@${GH_REPO_DEST}"
git push origin-wiki master
# Update snapshot in consolidated repository
cd ../${REPO_CONSOLIDATE}
if [ ! -d ${REPO_DEST} ]; then git submodule add https://${GH_REPO_DEST}; fi;
git submodule init
git submodule update --recursive --remote
cd ${REPO_DEST}
git checkout master
git pull
cd ..
git add .
git commit -m "${REPO_SOURCE} documentation | Travis CI build number $TRAVIS_BUILD_NUMBER"
git remote add origin-wiki "https://${GITHUB_TOKEN}@${GH_REPO_CONSOLIDATE}"
git push origin-wiki master
fi
- stage: Generate PDF
if: (type = push) AND (commit_message !~ /^PDF getting started \| Travis CI build number.*$/)
script:
- git config --global user.email ${EMAIL}
- git config --global user.name ${USER}
# Fix PNG images (getting-started already cloned)
- cd ${REPO_SOURCE}
- git checkout develop
- find . -name '*.png' -exec mogrify -interlace none -format png {} +
- find . -name '*.PNG' -exec mogrify -interlace none -format PNG {} +
# Generate PDF
- mvn clean package -Ddocgen.images.dir=images,documentation -Doutput.format=pdf
- mv ./target/generated-docs/master.pdf ./devonfw_getting_started.pdf
# Commit and push new getting started
- git add ./devonfw_getting_started.pdf
- git commit -m "PDF getting started | Travis CI build number $TRAVIS_BUILD_NUMBER"
- git remote add origin-pdf "https://${USER}:${GITHUB_TOKEN}@${GH_REPO_SOURCE}"
- git push origin-pdf develop