diff --git a/.travis.yml b/.travis.yml index 9b08d74..fc82b14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,12 +17,7 @@ install: - sphinx-build -j4 -D language=ja -D locale_dirs=locale -D gettext_compact=0 -A versionswitcher=1 -E -d build/doctrees . ../../py27 script: - cd ../../py27 -- git config user.email "travis-build-bot@example.com" -- git config user.name "Autobuild bot on Travis-CI" -- git pull origin master -- git add . -- if [ $(git status -s | wc -l) -eq 0 ]; then echo "nothing to commit"; exit 0; fi -- git commit -a -m "update html" +- ../py27-locale/update_github_pages.sh - git push --quiet "https://${GH_TOKEN}@github.com/python-doc-ja/py27.git" master:master env: diff --git a/update_github_pages.sh b/update_github_pages.sh new file mode 100755 index 0000000..09eb08c --- /dev/null +++ b/update_github_pages.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -Ceux + +git config user.email "travis-build-bot@example.com" +git config user.name "Autobuild bot on Travis-CI" +git config --local core.quotepath false +git pull origin master +if [ $(git status -s | wc -l) -eq 0 ]; then + echo "nothing to commit" + exit 0 +elif [ $(git --no-pager diff -G"最終更新日時: " | wc -l) -eq 0 ]; then + git add . +else + files_to_add=$(git --no-pager diff --numstat | awk '! ($1 == 1 && $2 == 1 && $3 ~ /.html$/) { print $3 }') + if [ -z "${files_to_add}" ]; then + echo "nothing to commit except for lines of '最終更新日時: '" + exit 0 + else + git add ${files_to_add} + fi +fi +git commit -m "update html"