|
| 1 | +dist:trusty |
| 2 | +sudo:false |
| 3 | +language:python |
| 4 | +python:'3.6' |
| 5 | +branches: |
| 6 | +only: |
| 7 | + -3.7 |
| 8 | +env: |
| 9 | +global: |
| 10 | +# branch name of python-docs-ja repository |
| 11 | + -DOCS_BRANCH=3.7 |
| 12 | +# branch name of cpython repository |
| 13 | + -CPYTHON_BRANCH=3.7 |
| 14 | +# branch name of cpython-doc-catalog repository |
| 15 | + -CATALOG_BRANCH=catalog-3.7 |
| 16 | +# Transifex project name |
| 17 | + -TRANSIFEX_PROJECT=python-newest |
| 18 | +before_install: |
| 19 | +-export TZ=Asia/Tokyo |
| 20 | +-git checkout ${DOCS_BRANCH} |
| 21 | +-cd .. |
| 22 | +-pwd |
| 23 | +-ls -la |
| 24 | +-BASEDIR="$(pwd)" |
| 25 | +-cd ~ |
| 26 | +-openssl aes-256-cbc -K ${encryption_37_K} -iv ${encryption_37_iv} -in "${BASEDIR}/python-docs-ja/secrets_${DOCS_BRANCH}.tar.enc" -out ~/secrets_{DOCS_BRANCH}.tar -d |
| 27 | +-tar xvf ~/secrets_{DOCS_BRANCH}.tar |
| 28 | +-rm ~/secrets_{DOCS_BRANCH}.tar |
| 29 | +-chmod 600 ~/.ssh/python-docs-ja_${DOCS_BRANCH} |
| 30 | +-chmod 600 ~/.ssh/cpython-doc-catalog_${CATALOG_BRANCH} |
| 31 | +# Hack from: https://gist.github.com/jamesmcfadden/d379e04e7ae2861414886af189ec59e5 |
| 32 | +-echo -e "Host python-docs-ja.github.com\n\tHostName github.com\n\tIdentityFile ~/.ssh/python-docs-ja_${DOCS_BRANCH}\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config |
| 33 | +-echo -e "Host cpython-doc-catalog.github.com\n\tHostName github.com\n\tIdentityFile ~/.ssh/cpython-doc-catalog_${CATALOG_BRANCH}\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config |
| 34 | +-cat ~/.ssh/config |
| 35 | +-git config --global user.email "travisci-build-bot@example.com" |
| 36 | +-git config --global user.name "Autobuild bot on TravisCI" |
| 37 | +install: |
| 38 | +-pip install sphinx |
| 39 | +-pip install blurb |
| 40 | +-pip install transifex-client |
| 41 | +-pip install sphinx-intl |
| 42 | +-cd "${BASEDIR}" |
| 43 | +-git clone --depth 50 --branch ${CATALOG_BRANCH} https://github.com/python-doc-ja/cpython-doc-catalog.git cpython-doc-catalog |
| 44 | +-mkdir -p "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja |
| 45 | +-cd "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja |
| 46 | +-ln -s "${BASEDIR}"/python-docs-ja LC_MESSAGES |
| 47 | +-ls -lF LC_MESSAGES |
| 48 | +script: |
| 49 | +# upload-catalog |
| 50 | +-cd "${BASEDIR}"/cpython-doc-catalog/Doc/locales |
| 51 | +-tx pull --force --language ja |
| 52 | +-cd ja/LC_MESSAGES |
| 53 | +-git add *.po **/*.po |
| 54 | +-git status |
| 55 | +-if [ $(git status --short | wc -l) -eq 0 ]; then echo "no .po file to upload"; else echo "I have .po file(s) to upload"; git commit --message="[skip ci] Update .po files"; git push --quiet "git@python-docs-ja.github.com:python/python-docs-ja.git" ${DOCS_BRANCH}:${DOCS_BRANCH}; fi |
| 56 | +-rm -rf "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja |
| 57 | +# renew-catalog-template |
| 58 | +-cd "${BASEDIR}"/cpython-doc-catalog |
| 59 | +-git remote add upstream https://github.com/python/cpython.git |
| 60 | +-git remote -v |
| 61 | +-git fetch --quiet upstream |
| 62 | +-git merge --no-ff upstream/${CPYTHON_BRANCH} -m "Merge remote-tracking branch 'upstream/${CPYTHON_BRANCH}' into ${CATALOG_BRANCH} by Autobuild bot on TravisCI" |
| 63 | +-cd Doc |
| 64 | +-make build ALLSPHINXOPTS="-E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot" |
| 65 | +-ls -lt locales/pot |
| 66 | +-cd locales |
| 67 | +-git add pot |
| 68 | +-if [ $(git status -s | wc -l) -eq 0 ]; then echo "no .pot file to update"; exit 0; else echo "I have .pot file(s) to upload"; fi |
| 69 | +-rm -rf .tx |
| 70 | +-sphinx-intl create-txconfig |
| 71 | +-sphinx-intl update-txconfig-resources --transifex-project-name=${TRANSIFEX_PROJECT} --locale-dir . --pot-dir pot |
| 72 | +-tx push -s |
| 73 | +-git add .tx |
| 74 | +-git commit --message="[skip ci] Update .pot files and .tx/config" |
| 75 | +-git push --quiet "git@cpython-doc-catalog.github.com:python-doc-ja/cpython-doc-catalog.git" ${CATALOG_BRANCH}:${CATALOG_BRANCH} |