@@ -14,16 +14,16 @@ set -o errexit
14
14
bold=$( tput bold)
15
15
normal=$( tput sgr0)
16
16
17
- if [ -z ${DOCS_BRANCH_NAME+x} ]; then
17
+ if [[ -z ${DOCS_BRANCH_NAME+x} ] ]; then
18
18
echo " ${bold} \$ DOCS_BRANCH_NAME is not set!${normal} "
19
19
exit 1
20
- elif [ -z ${DOCS_REPO_NAME+x} ]; then
20
+ elif [[ -z ${DOCS_REPO_NAME+x} ] ]; then
21
21
echo " ${bold} \$ DOCS_REPO_NAME is not set!${normal} "
22
22
exit 1
23
- elif [ -z ${DOCS_REPO_OWNER+x} ]; then
23
+ elif [[ -z ${DOCS_REPO_OWNER+x} ] ]; then
24
24
echo " ${bold} \$ DOCS_REPO_OWNER is not set!${normal} "
25
25
exit 1
26
- elif [ -z ${GH_TOKEN+x} ]; then
26
+ elif [[ -z ${GH_TOKEN+x} ] ]; then
27
27
echo " ${bold} \$ GH_TOKEN is not set!${normal} "
28
28
exit 1
29
29
fi
@@ -34,8 +34,18 @@ git config user.email "travis@travis-ci.org"
34
34
GH_REPO_REF=" github.com/${DOCS_REPO_OWNER} /${DOCS_REPO_NAME} .git"
35
35
36
36
# Assume the book has already been built and lives in $BOOK_BUILD_DIR.
37
+ book_check_file=" ${BOOK_BUILD_DIR} /index.html"
37
38
38
- if [ -d " ${BOOK_BUILD_DIR} " ]; then
39
+ if [[ ! -d " ${BOOK_BUILD_DIR} " ]]; then
40
+ echo " " >&2
41
+ echo " ${bold} Warning: The book directory wasn't found!${normal} " >&2
42
+ echo " ${bold} Warning: Not going to push the book to GitHub!${normal} " >&2
43
+ exit 1
44
+ elif [[ ! -f " ${book_check_file} " ]]; then
45
+ echo " ${bold}${book_check_file} not found!${normal} " >&2
46
+ echo " ${bold}${BOOK_BUILD_DIR} is present though.${normal} " >&2
47
+ exit 1
48
+ else
39
49
echo " ${bold} Cloning the website repo...${normal} "
40
50
git clone -b " ${DOCS_BRANCH_NAME} " https://git@" ${GH_REPO_REF} "
41
51
rm -rf ./" ${DOCS_REPO_NAME} " /*
@@ -52,9 +62,4 @@ if [ -d "${BOOK_BUILD_DIR}" ]; then
52
62
-m " Commit: ${TRAVIS_COMMIT} " || ret=$?
53
63
git push " https://${GH_TOKEN} @${GH_REPO_REF} "
54
64
popd
55
- else
56
- echo " " >&2
57
- echo " ${bold} Warning: The book wasn't found!${normal} " >&2
58
- echo " ${bold} Warning: Not going to push the book to GitHub!${normal} " >&2
59
- exit 1
60
65
fi
0 commit comments