Skip to content

Commit 6517010

Browse files
authored
Travis fixes for HonKit, take 2 (#729)
* Print all environment variables and export book build dir var * A stronger check for if the book build in the expected location * Check for index.html again in deploy script
1 parent dd3e327 commit 6517010

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

.travis.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ node_js:
66
- "12"
77

88
before_script:
9-
- BOOK_BUILD_DIR="${TRAVIS_BUILD_DIR}"/_book
9+
- export BOOK_BUILD_DIR="${TRAVIS_BUILD_DIR}"/_book
10+
- env | sort
1011

1112
script:
1213
- npm run build
14+
# Make sure the book built.
15+
- |
16+
book_check_file="${BOOK_BUILD_DIR}/index.html"
17+
if [[ ! -f "${book_check_file}" ]]; then
18+
echo "${book_check_file} not found"
19+
exit 1
20+
fi
1321
1422
after_success:
1523
- |

tools/deploy/update_site_travis.bash

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ set -o errexit
1414
bold=$(tput bold)
1515
normal=$(tput sgr0)
1616

17-
if [ -z ${DOCS_BRANCH_NAME+x} ]; then
17+
if [[ -z ${DOCS_BRANCH_NAME+x} ]]; then
1818
echo "${bold}\$DOCS_BRANCH_NAME is not set!${normal}"
1919
exit 1
20-
elif [ -z ${DOCS_REPO_NAME+x} ]; then
20+
elif [[ -z ${DOCS_REPO_NAME+x} ]]; then
2121
echo "${bold}\$DOCS_REPO_NAME is not set!${normal}"
2222
exit 1
23-
elif [ -z ${DOCS_REPO_OWNER+x} ]; then
23+
elif [[ -z ${DOCS_REPO_OWNER+x} ]]; then
2424
echo "${bold}\$DOCS_REPO_OWNER is not set!${normal}"
2525
exit 1
26-
elif [ -z ${GH_TOKEN+x} ]; then
26+
elif [[ -z ${GH_TOKEN+x} ]]; then
2727
echo "${bold}\$GH_TOKEN is not set!${normal}"
2828
exit 1
2929
fi
@@ -34,8 +34,18 @@ git config user.email "travis@travis-ci.org"
3434
GH_REPO_REF="github.com/${DOCS_REPO_OWNER}/${DOCS_REPO_NAME}.git"
3535

3636
# Assume the book has already been built and lives in $BOOK_BUILD_DIR.
37+
book_check_file="${BOOK_BUILD_DIR}/index.html"
3738

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
3949
echo "${bold}Cloning the website repo...${normal}"
4050
git clone -b "${DOCS_BRANCH_NAME}" https://git@"${GH_REPO_REF}"
4151
rm -rf ./"${DOCS_REPO_NAME}"/*
@@ -52,9 +62,4 @@ if [ -d "${BOOK_BUILD_DIR}" ]; then
5262
-m "Commit: ${TRAVIS_COMMIT}" || ret=$?
5363
git push "https://${GH_TOKEN}@${GH_REPO_REF}"
5464
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
6065
fi

0 commit comments

Comments
 (0)