Skip to content

Commit 9224f92

Browse files
authored
Feature/using GitHub actions (#33)
* [WIP] Add update.yml * Get rid of unnecessary files * Fix file's name
1 parent 563e84f commit 9224f92

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

scripts/renew-catalog-template.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# merge from upstream
5+
cd "${BASEDIR}"/cpython-doc-catalog
6+
git remote add upstream https://github.com/python/cpython.git
7+
git remote -v
8+
git fetch --quiet upstream
9+
git merge --no-ff upstream/${CPYTHON_BRANCH} -m "Merge remote-tracking branch 'upstream/${CPYTHON_BRANCH}' into ${CATALOG_BRANCH} by Autobuild bot on TravisCI"
10+
11+
# generate catalog
12+
cd Doc
13+
make build ALLSPHINXOPTS="-E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot"
14+
ls -lt locales/pot
15+
16+
# upload catalog templates to cpython-doc-catalog
17+
cd locales
18+
git add pot
19+
git status
20+
if [[ $(git status --short | wc -l) == 0 ]]; then
21+
echo "no .pot file to update"
22+
exit 0
23+
fi
24+
25+
echo "I have .pot file(s) to upload"
26+
27+
rm -rf .tx
28+
sphinx-intl create-txconfig
29+
sphinx-intl update-txconfig-resources --transifex-project-name=${TRANSIFEX_PROJECT} --locale-dir . --pot-dir pot
30+
tx push --source --parallel
31+
git add .tx
32+
git commit --message="[skip ci] Update .pot files and .tx/config"
33+
git push --quiet "git@cpython-doc-catalog.github.com:python-doc-ja/cpython-doc-catalog.git" ${CATALOG_BRANCH}:${CATALOG_BRANCH}

scripts/upload-catalog.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -eux
3+
4+
# clone an additional repository
5+
cd "${BASEDIR}"
6+
git clone --branch ${CATALOG_BRANCH} https://github.com/python-doc-ja/cpython-doc-catalog.git cpython-doc-catalog
7+
mkdir -p "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja
8+
cd "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja
9+
ln -s "${BASEDIR}"/python-docs-ja LC_MESSAGES
10+
ls -lF LC_MESSAGES
11+
12+
# upload catalogs to python-docs-ja
13+
cd "${BASEDIR}"/cpython-doc-catalog/Doc/locales
14+
if [ ! -e .tx/config ]; then
15+
echo ".tx/config does not exist. Skip uploading catalogs to python-docs-ja"
16+
exit 0
17+
fi
18+
19+
tx pull --force --language ja --parallel
20+
cd ja/LC_MESSAGES
21+
git add *.po **/*.po
22+
git status
23+
if [[ $(git status --short | wc -l) == 0 ]]; then
24+
echo "no .po file to upload"
25+
else
26+
echo "I have .po file(s) to upload"
27+
git commit --message="[skip ci] Update .po files"
28+
git push --quiet "git@python-docs-ja.github.com:python/python-docs-ja.git" ${DOCS_BRANCH}:${DOCS_BRANCH}
29+
fi
30+
rm -rf "${BASEDIR}"/cpython-doc-catalog/Doc/locales/ja

0 commit comments

Comments
 (0)