File tree Expand file tree Collapse file tree 8 files changed +142
-0
lines changed Expand file tree Collapse file tree 8 files changed +142
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM debian:stable-slim
2+
3+ RUN set -ex \
4+ && apt-get update \
5+ && apt-get install -y --no-install-recommends git ca-certificates \
6+ && apt-get clean \
7+ && rm -rf /var/lib/apt/lists/*
8+
9+ ADD entrypoint.sh /entrypoint.sh
10+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ name : Commit Translation
2+ description : Commit translation in git repo and push to remote
3+ runs :
4+ using : ' docker'
5+ image : ' Dockerfile'
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -ex
4+
5+ cd docs || exit 1
6+ git config user.email " actions@users.noreply.github.com"
7+ git config user.name " Github Actions"
8+ if git status -s| grep ' \.po' ; then
9+ git add .
10+ git commit -m ' [po] auto sync'
11+ header=" $( echo -n token:" $GITHUB_TOKEN " | base64) "
12+ git -c http.extraheader=" AUTHORIZATION: basic $header " push
13+ fi
Original file line number Diff line number Diff line change 1+ FROM python:3-slim
2+
3+ RUN set -ex \
4+ && pip install transifex-client \
5+ && rm -rf ~/.cache \
6+ && apt-get update \
7+ && apt-get install -y --no-install-recommends git make \
8+ && apt-get clean \
9+ && rm -rf /var/lib/apt/lists/*
10+
11+ ADD entrypoint.sh /entrypoint.sh
12+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ name : Update Translation
2+ description : Update Python Doc Translation from Transifex
3+ inputs :
4+ pythonVersion :
5+ description : Python Version
6+ required : true
7+ locale :
8+ description : Locale Name
9+ required : true
10+ default : zh_CN
11+ runs :
12+ using : ' docker'
13+ image : ' Dockerfile'
14+ args :
15+ - ${{ inputs.pythonVersion }}
16+ - ${{ inputs.locale }}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -ex
4+
5+ pythonVersion=" $1 "
6+ locale=" $2 "
7+
8+ echo " Python Version: $pythonVersion "
9+ echo " Locale: $locale "
10+
11+ cur=$( pwd)
12+ git clone --depth=1 --branch=" $pythonVersion " https://github.com/python/cpython cpython
13+ git clone --branch=" $pythonVersion " https://github.com/" $GITHUB_REPOSITORY " docs
14+
15+ if [[ -n " $TRANSIFEX_APIKEY " ]]; then
16+ cat > ~ /.transifexrc << EOF
17+ [https://www.transifex.com]
18+ api_hostname = https://api.transifex.com
19+ hostname = https://www.transifex.com
20+ password = $TRANSIFEX_APIKEY
21+ username = api
22+ EOF
23+ fi
24+
25+ # Pull Transifex translation
26+ pushd docs || exit 1
27+ tx pull --force --parallel --language " $locale "
28+ popd || exit 1
29+
30+ # Test building docs
31+ pushd cpython/Doc || exit 1
32+ mkdir -p locales/" $locale " /
33+ ln -sfn " $cur " /docs locales/" $locale " /LC_MESSAGES
34+ make venv
35+ make html SPHINXOPTS=" -D language=$locale -D gettext_compact=0 -j4 -W --keep-going"
36+ popd || exit 1
Original file line number Diff line number Diff line change 1+ name : python-37
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ schedule :
8+ - cron : " 38 * * * *"
9+
10+ jobs :
11+ update :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v1
15+ with :
16+ fetch-depth : 1
17+ - uses : ./.github/actions/update
18+ with :
19+ pythonVersion : " 3.7"
20+ locale : zh_CN
21+ env :
22+ TRANSIFEX_APIKEY : ${{ secrets.TRANSIFEX_APIKEY }}
23+ - uses : ./.github/actions/commit
24+ env :
25+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1+ name : python-38
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ schedule :
8+ - cron : " 18 * * * *"
9+
10+ jobs :
11+ update :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v1
15+ with :
16+ fetch-depth : 1
17+ - uses : ./.github/actions/update
18+ with :
19+ pythonVersion : " 3.8"
20+ locale : zh_CN
21+ env :
22+ TRANSIFEX_APIKEY : ${{ secrets.TRANSIFEX_APIKEY }}
23+ - uses : ./.github/actions/commit
24+ env :
25+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments