From 6dd0c6eaa9c44939209435c8c9d93634c0bf2f49 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Wed, 8 Jul 2020 10:05:00 -0400 Subject: [PATCH 1/3] Print all environment variables and export book build dir var --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c4dc98ab4..8281a2426 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,8 @@ node_js: - "12" before_script: - - BOOK_BUILD_DIR="${TRAVIS_BUILD_DIR}"/_book + - export BOOK_BUILD_DIR="${TRAVIS_BUILD_DIR}"/_book + - env | sort script: - npm run build From de793f05de81a4ad11d01cb0ffb0b475da7abb27 Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Wed, 8 Jul 2020 09:52:23 -0400 Subject: [PATCH 2/3] A stronger check for if the book build in the expected location --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8281a2426..b497e39e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,13 @@ before_script: script: - npm run build + # Make sure the book built. + - | + book_check_file="${BOOK_BUILD_DIR}/index.html" + if [[ ! -f "${book_check_file}" ]]; then + echo "${book_check_file} not found" + exit 1 + fi after_success: - | From d408d6d4f3b192bf28fd87399c36161208a5c86d Mon Sep 17 00:00:00 2001 From: Eric Berquist Date: Wed, 8 Jul 2020 10:50:11 -0400 Subject: [PATCH 3/3] Check for index.html again in deploy script --- tools/deploy/update_site_travis.bash | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tools/deploy/update_site_travis.bash b/tools/deploy/update_site_travis.bash index 5ab116ee7..0503abd2a 100644 --- a/tools/deploy/update_site_travis.bash +++ b/tools/deploy/update_site_travis.bash @@ -14,16 +14,16 @@ set -o errexit bold=$(tput bold) normal=$(tput sgr0) -if [ -z ${DOCS_BRANCH_NAME+x} ]; then +if [[ -z ${DOCS_BRANCH_NAME+x} ]]; then echo "${bold}\$DOCS_BRANCH_NAME is not set!${normal}" exit 1 -elif [ -z ${DOCS_REPO_NAME+x} ]; then +elif [[ -z ${DOCS_REPO_NAME+x} ]]; then echo "${bold}\$DOCS_REPO_NAME is not set!${normal}" exit 1 -elif [ -z ${DOCS_REPO_OWNER+x} ]; then +elif [[ -z ${DOCS_REPO_OWNER+x} ]]; then echo "${bold}\$DOCS_REPO_OWNER is not set!${normal}" exit 1 -elif [ -z ${GH_TOKEN+x} ]; then +elif [[ -z ${GH_TOKEN+x} ]]; then echo "${bold}\$GH_TOKEN is not set!${normal}" exit 1 fi @@ -34,8 +34,18 @@ git config user.email "travis@travis-ci.org" GH_REPO_REF="github.com/${DOCS_REPO_OWNER}/${DOCS_REPO_NAME}.git" # Assume the book has already been built and lives in $BOOK_BUILD_DIR. +book_check_file="${BOOK_BUILD_DIR}/index.html" -if [ -d "${BOOK_BUILD_DIR}" ]; then +if [[ ! -d "${BOOK_BUILD_DIR}" ]]; then + echo "" >&2 + echo "${bold}Warning: The book directory wasn't found!${normal}" >&2 + echo "${bold}Warning: Not going to push the book to GitHub!${normal}" >&2 + exit 1 +elif [[ ! -f "${book_check_file}" ]]; then + echo "${bold}${book_check_file} not found!${normal}" >&2 + echo "${bold}${BOOK_BUILD_DIR} is present though.${normal}" >&2 + exit 1 +else echo "${bold}Cloning the website repo...${normal}" git clone -b "${DOCS_BRANCH_NAME}" https://git@"${GH_REPO_REF}" rm -rf ./"${DOCS_REPO_NAME}"/* @@ -52,9 +62,4 @@ if [ -d "${BOOK_BUILD_DIR}" ]; then -m "Commit: ${TRAVIS_COMMIT}" || ret=$? git push "https://${GH_TOKEN}@${GH_REPO_REF}" popd -else - echo "" >&2 - echo "${bold}Warning: The book wasn't found!${normal}" >&2 - echo "${bold}Warning: Not going to push the book to GitHub!${normal}" >&2 - exit 1 fi