Skip to content

Commit 7d7ddb8

Browse files
committed
Add a script to generate docs on Travis CI
1 parent 8379143 commit 7d7ddb8

3 files changed

Lines changed: 35 additions & 3 deletions

File tree

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ matrix:
88
- bundle exec danger
99
script:
1010
- bundle exec rake ci:build[$VERSION]
11-
- make carthage
11+
- make -B carthage
12+
- make -B docs
1213
after_script:
13-
- make documentation
14+
- sh scripts/update-docs.sh
1415
cache:
1516
bundler: true
1617
directories:

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@ setup: brew-install
1818
carthage:
1919
set -o pipefail && carthage build --no-skip-current --verbose | xcpretty
2020

21-
documentation:
21+
docs:
22+
rm -rfv docs
23+
git clone -b gh-pages --single-branch https://github.com/polydice/ICInputAccessory.git docs
2224
bundle exec jazzy --config .jazzy.yml

scripts/update-docs.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
files=(html css js json)
4+
5+
for file in "${files[@]}"
6+
do
7+
echo "Cleaning whitespace in *.$file..."
8+
find docs/output -name "*."$file -exec sed -E -i '' -e 's/[[:blank:]]*$//' {} \;
9+
done
10+
11+
12+
cd docs && pwd
13+
git checkout gh-pages
14+
git status
15+
cp -rfv output/* .
16+
git --no-pager diff --stat
17+
git add .
18+
git commit -m "[CI] Update documentation at $(date +'%Y-%m-%d %H:%M:%S %z')"
19+
20+
if [ "${TRAVIS_BRANCH}" = "feature/auto-generated-docs" ]; then
21+
echo "Updating gh-pages..."
22+
git remote add upstream "https://${DANGER_GITHUB_API_TOKEN}@github.com/polydice/ICInputAccessory.git"
23+
git push --quiet upstream HEAD:gh-pages
24+
git remote remove upstream
25+
else
26+
echo "Skip gh-pages updates on ${TRAVIS_BRANCH}"
27+
fi
28+
29+
cd -

0 commit comments

Comments
 (0)