2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00
koreader/.ci/after_success.sh
Frans de Jonge e8c01274f4 Travis: enforce shellscript coding style
* enormous coding style update

* update luajit-launcher

All changes are formatting only except for:

* new more correct pushd/popd style
	* keeps useful indentation
	* prevents execution of commands when pushd failed (cf. https://github.com/koalaman/shellcheck/wiki/SC2164 and https://github.com/koalaman/shellcheck/issues/863)

```
pushd some_dir && {
    command1
    command2
} || exit
popd
```
2017-04-11 15:30:23 +02:00

47 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# shellcheck source=/dev/null
source "${CI_DIR}/common.sh"
set +e
if [ "${TRAVIS_PULL_REQUEST}" = false ] && [ "${TRAVIS_BRANCH}" = 'master' ]; then
travis_retry luarocks --local install ldoc
# get deploy key for doc repo
openssl aes-256-cbc -k "${doc_build_secret:?}" -in .ci/koreader_doc.enc -out ~/.ssh/koreader_doc -d
chmod 600 ~/.ssh/koreader_doc # make agent happy
eval "$(ssh-agent)" >/dev/null
ssh-add ~/.ssh/koreader_doc >/dev/null
echo -e "\n${ANSI_GREEN}Check out koreader/doc for update."
git clone git@github.com:koreader/doc.git koreader_doc
# push doc update
pushd doc && {
luajit "$(which ldoc)" . 2>/dev/null
if [ ! -d html ]; then
echo "Failed to generate documents..."
exit 1
fi
} || exit
popd
cp -r doc/html/* koreader_doc/
pushd koreader_doc && {
git add -A
echo -e "\n${ANSI_GREEN}Pusing document update..."
git -c user.name="KOReader build bot" -c user.email="non-reply@koreader.rocks" \
commit -a --amend -m 'Automated documentation build from travis-ci.'
git push -f --quiet origin gh-pages >/dev/null
echo -e "\n${ANSI_GREEN}Documentation update pushed."
} || exit
popd
travis_retry make coverage
pushd koreader-*/koreader && {
luajit "$(which luacov-coveralls)"
} || exit
popd
else
echo -e "\n${ANSI_GREEN}Not on official master branch, skip documentation update and coverage."
fi