diff --git a/.travis.yml b/.travis.yml index 5cb9ff714..25fa93930 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}') + condition: $TRAVIS_REPO_SLUG = $SPACEMACS_REPO_SLUG && $(git remote update) && $(git rev-parse '@') = $(git rev-parse '@{u}') && $HAS_DOC_FIXES = true - provider: script skip_cleanup: true script: ".travisci/pub_html.sh" diff --git a/.travisci/pub_org.sh b/.travisci/pub_org.sh index f15183a6e..76d1310d2 100755 --- a/.travisci/pub_org.sh +++ b/.travisci/pub_org.sh @@ -33,12 +33,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/${SPACEMACS_REPO_SLUG}.git" git clone "${target_URL}" -b "${TRAVIS_BRANCH}" "/tmp/${PUBLISH}" @@ -48,22 +42,14 @@ if [ $? -ne 0 ]; then fi fold_end "CLONING_TARGET_REPOSITORY" -fold_start "SELECTING_CHANGED_FILES" -rsync -rv \ - --include '*/' \ - --include='*.org' \ - --exclude='*' \ - --prune-empty-dirs \ - ~/.emacs.d/ \ - "/tmp/${PUBLISH}" +fold_start "APPLYING DOCUMENTATION PATCH" cd "/tmp/${PUBLISH}" -/tmp/hub add --all -/tmp/hub commit -m "documentation formatting: $(date -u)" +git am < /tmp/docfmt.patch if [ $? -ne 0 ]; then - echo "Nothing to commit - exiting." - exit 0 + echo "Failed to apply documentation fixes patch" + exit 2 fi -fold_end "SELECTING_CHANGED_FILES" +fold_end "APPLYING DOCUMENTATION PATCH" fold_start "PUSHING_CHANGES_TO_${BOT_NAME}/${PUBLISH}" /tmp/hub fork diff --git a/.travisci/pub_prep.sh b/.travisci/pub_prep.sh index 2525473f5..10c70b215 100755 --- a/.travisci/pub_prep.sh +++ b/.travisci/pub_prep.sh @@ -24,6 +24,12 @@ printf "Host github.com\n" > ~/.ssh/config printf " StrictHostKeyChecking no\n" >> ~/.ssh/config printf " UserKnownHostsFile=/dev/null\n" >> ~/.ssh/config +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 "FORMATTING_DOCUMENTATION" docker run --rm \ -v "${TRAVIS_BUILD_DIR}/.ci/spacedoc-cfg.edn":/opt/spacetools/spacedoc-cfg.edn \ @@ -35,6 +41,18 @@ if [ $? -ne 0 ]; then fi fold_end "FORMATTING_DOCUMENTATION" +fold_start "CREATING_DOCUMENTATION_PATCH_FILE" +git add --all +git commit -m "documentation formatting: $(date -u)" +if [ $? -ne 0 ]; then + echo "Nothing to commit - exiting." + exit 0 +fi +export HAS_DOC_FIXES=true +git format-patch -1 HEAD --stdout > /tmp/docfmt.patch +cat /tmp/docfmt.patch +fold_end "CREATING_DOCUMENTATION_PATCH_FILE" + rm -rf ~/.emacs.d mv "${TRAVIS_BUILD_DIR}" ~/.emacs.d cd ~/.emacs.d