Skip to content

Improve ci #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Dec 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Check out CPython
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: python/cpython
persist-credentials: false
ref: ${{ env.CPYTHON_BRANCH }}
path: cpython
- name: Set up Python 3.9
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install Transifex CLI
run: |
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
working-directory: /usr/local/bin
- name: Install dependencies
run: |
sudo apt update -y && sudo apt install gettext -y
Expand Down Expand Up @@ -79,14 +85,20 @@ jobs:
run:
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Check out source branch (${{ env.CURRENT_BRANCH }})
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
path: ${{ env.CURRENT_BRANCH }}
- name: Check out target branch (${{ matrix.branch }})
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ matrix.branch }}
path: ${{ matrix.branch }}
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
run: |
sudo apt update -y && sudo apt install gettext -y
Expand All @@ -103,7 +115,7 @@ jobs:
run: |
powrap --modified -C ${{ matrix.branch }}
- name: Commit and push changes
if: github.repository == 'rffontenelle/python-docs-pt-br'
if: github.repository == 'python/python-docs-ja'
run: |
cd ${{ matrix.branch }}
git config user.name github-actions
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
transifex-client
sphinx
sphinx-intl
git+https://github.com/sphinx-doc/sphinx-intl@6b3913fea5a8c9b819818b9b28b6d0d0b6f022b3
powrap
pospell
pomerge
29 changes: 11 additions & 18 deletions scripts/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ set -e
# Allow language being passed as 1st argument, defaults to ja
LANGUAGE=${1:-ja}

ROOTDIR=$(dirname $0)/..
ROOTDIR=$(realpath "$(dirname $0)/..")

cd ${ROOTDIR}
cd "${ROOTDIR}"

if ! test -f cpython/Doc/conf.py; then
echo Unable to find proper CPython Doc folder
Expand All @@ -21,22 +21,15 @@ cd cpython/Doc
sphinx-build -E -b gettext -D gettext_compact=0 -d build/.doctrees . locales/pot

# Update CPython's .tx/config
cd locales
cd locales
sphinx-intl create-txconfig
sphinx-intl update-txconfig-resources -p pot -d . --transifex-project-name python-newest
sphinx-intl update-txconfig-resources -p pot -d . --transifex-organization-name python-doc --transifex-project-name python-newest

if [ "$CI" = true ]
then
tx push --source --no-interactive --skip
fi

# Update the translation project's .tx/config
cd ../../.. # back to $ROOTDIR
mkdir -p .tx
sed cpython/Doc/locales/.tx/config \
-e '/^source_file/d' \
-e 's|<lang>/LC_MESSAGES/||' \
-e "s|^file_filter|trans.${LANGUAGE}|" \
> .tx/config
# Pull translations into cpython/Doc/locales/LANGUAGE/LC_MESSAGES/
tx pull -l ${LANGUAGE} -t --use-git-timestamps

tx pull -l ${LANGUAGE} --use-git-timestamps --parallel
# Finally, move downloaded translation files to the language's repository
cd "${LANGUAGE}/LC_MESSAGES/"
for po in $(find . -type f -name '*.po' | sort | sed 's|^\./||'); do
install -Dm644 ${po} "${ROOTDIR}/${po}"
done