Fix revision check

This commit is contained in:
JAremko 2019-12-09 22:47:10 +02:00 committed by Eugene Yaremenko
parent e1eb157c63
commit f594ac78c9
4 changed files with 34 additions and 8 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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 \