Use patches to fix docs

This commit is contained in:
JAremko 2019-12-05 12:37:00 +02:00 committed by Eugene Yaremenko
parent 9f5e76e091
commit 96546ceb4e
3 changed files with 24 additions and 20 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}')
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"

View File

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

View File

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