diff --git a/.travis.yml b/.travis.yml index 25fa93930..078b6f5e5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,7 +26,7 @@ deploy: branch: develop # Deploy only if we are in the official repo and # the local revision matches origin's head - condition: $TRAVIS_REPO_SLUG = $SPACEMACS_REPO_SLUG && $(git remote update) && $(git rev-parse '@') = $(git rev-parse '@{u}') && $HAS_DOC_FIXES = true + condition: $TRAVIS_REPO_SLUG = $SPACEMACS_REPO_SLUG && $HAS_DOC_FIXES = true - provider: script skip_cleanup: true script: ".travisci/pub_html.sh" @@ -34,4 +34,4 @@ deploy: all_branches: true # Deploy only if we are in the official repo and # the local revision matches origin's head - condition: $TRAVIS_REPO_SLUG = $SPACEMACS_REPO_SLUG && $(git remote update) && $(git rev-parse '@') = $(git rev-parse '@{u}') + condition: $TRAVIS_REPO_SLUG = $SPACEMACS_REPO_SLUG diff --git a/.travisci/pub_html.sh b/.travisci/pub_html.sh index 3bf3a6a6e..fa83b8214 100755 --- a/.travisci/pub_html.sh +++ b/.travisci/pub_html.sh @@ -35,12 +35,6 @@ if [ `git rev-list HEAD...origin/$TRAVIS_BRANCH --count` != 0 ]; then exit 0 fi -git config --global user.name "${BOT_NAME}" -git config --global user.email "${BOT_EMAIL}" -git config --global push.default simple -git config --global hub.protocol https -export GITHUB_TOKEN=$BOT_TK - fold_start "CLONING_TARGET_REPOSITORY" target_URL="https://github.com/syl20bnr/${PUBLISH}.git" git clone "${target_URL}" -b gh-pages "/tmp/${PUBLISH}" @@ -61,7 +55,21 @@ if [ $? -ne 0 ]; then fi fold_end "SELECTING_CHANGED_FILES" +fold_start "CHECKING_IF_SPACEMACS_HEAD_IS_THE_SAME" +cd ~/.emacs.d +git remote update +rem_rev=$(git rev-parse '@{u}') +echo "Base revision: $BASE_REVISION" +echo "Remote revision: $rem_rev" +if [ "$BASE_REVISION" != "$rem_rev" ]; then + echo "Looks like Spacemacs head has changed while we generated files." + echo "Aborting." + exit 0 +fi +fold_end "CHECKING_IF_SPACEMACS_HEAD_IS_THE_SAME" + fold_start "PUSHING_CHANGES_TO_${BOT_NAME}/${PUBLISH}" +cd "/tmp/${PUBLISH}" /tmp/hub fork if [ $? -ne 0 ]; then echo "hub fork failed" diff --git a/.travisci/pub_org.sh b/.travisci/pub_org.sh index 76d1310d2..93e282689 100755 --- a/.travisci/pub_org.sh +++ b/.travisci/pub_org.sh @@ -51,7 +51,21 @@ if [ $? -ne 0 ]; then fi fold_end "APPLYING DOCUMENTATION PATCH" +fold_start "CHECKING_IF_SPACEMACS_HEAD_IS_THE_SAME" +cd ~/.emacs.d +git remote update +rem_rev=$(git rev-parse '@{u}') +echo "Base revision: $BASE_REVISION" +echo "Remote revision: $rem_rev" +if [ "$BASE_REVISION" != "$rem_rev" ]; then + echo "Looks like Spacemacs head has changed while we generated files." + echo "Aborting." + exit 0 +fi +fold_end "CHECKING_IF_SPACEMACS_HEAD_IS_THE_SAME" + fold_start "PUSHING_CHANGES_TO_${BOT_NAME}/${PUBLISH}" +cd "/tmp/${PUBLISH}" /tmp/hub fork if [ $? -ne 0 ]; then echo "hub fork failed" diff --git a/.travisci/pub_prep.sh b/.travisci/pub_prep.sh index 242b3a6c2..f7a531b28 100755 --- a/.travisci/pub_prep.sh +++ b/.travisci/pub_prep.sh @@ -30,6 +30,10 @@ git config --global push.default simple git config --global hub.protocol https export GITHUB_TOKEN=$BOT_TK +git remote update +export BASE_REVISION=$(git rev-parse '@') +echo "Base revision $BASE_REVISION" + fold_start "FORMATTING_DOCUMENTATION" docker run --rm \ -v "${TRAVIS_BUILD_DIR}/.ci/spacedoc-cfg.edn":/opt/spacetools/spacedoc-cfg.edn \