@@ -32,41 +32,22 @@ jobs:
3232 - name : Check out this repository
3333 uses : actions/checkout@v5
3434
35- - name : Checkout CPython ${{ env.PYDOC_VERSION }}
36- uses : actions/checkout@v5
37- with :
38- repository : ' python/cpython'
39- ref : ${{ env.PYDOC_VERSION }}
40- path : cpython
41-
4235 - name : Set language dir variable
4336 run :
44- echo "LANGUAGE_DIR=cpython/Doc/locales/ ${{ env.PYDOC_LANGUAGE }}/LC_MESSAGES " >> $GITHUB_ENV
37+ echo "PYDOC_LANG_DIR= ${{ env.PYDOC_VERSION }}" >> $GITHUB_ENV
4538
4639 - name : Checkout this repository ${{ env.PYDOC_VERSION }}
4740 uses : actions/checkout@v5
4841 with :
4942 ref : ${{ env.PYDOC_VERSION }}
50- path : ${{ env.LANGUAGE_DIR }}
43+ path : ${{ env.PYDOC_LANG_DIR }}
5144
5245 - uses : actions/setup-python@v6
5346 with :
5447 python-version : ${{ inputs.version }}
5548 allow-prereleases : true
5649 cache : ' pip'
57- cache-dependency-path : |
58- requirements.txt
59- cpython/Doc/requirements.txt
60-
61- - name : Check for Transifex API Token availability
62- id : secret-check
63- # perform secret check & put boolean result as an output
64- shell : bash
65- run : |
66- available=false
67- [[ "${{ secrets.TX_TOKEN }}" != '' ]] && available=true
68- echo "available=$available" >> $GITHUB_OUTPUT
69- echo "available=$available"
50+ cache-dependency-path : requirements.txt
7051
7152 # 2- Install dependencies
7253
@@ -81,19 +62,19 @@ jobs:
8162 - name : Install Python dependencies
8263 run : |
8364 pip install -r requirements.txt
84- make -C cpython/Doc venv
8565
8666 # 3- Pull translations
8767
88- - name : Generate template files and Transifex config file
89- run : ./scripts/generate_templates.sh
68+ - name : Generate updated .tx/config
69+ if : ${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
70+ run : python scripts/generate_txconfig.py -p ./${{ env.PYDOC_LANG_DIR }} ${{ env.PYDOC_TX_PROJECT }}
9071
9172 - name : Pull translations from Transifex
9273 id : pull
9374 if : ${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
9475 run : |
9576 # Clean up obsolete files
96- find ./${{ env.LANGUAGE_DIR }} -name '*.po' -exec rm {} \;
77+ find ./${{ env.PYDOC_LANG_DIR }} -name '*.po' -exec rm {} \;
9778 ./scripts/pull_translations.sh
9879 env :
9980 TX_TOKEN : ${{ secrets.TX_TOKEN }}
@@ -103,36 +84,42 @@ jobs:
10384 run : |
10485 newer_branch=${PYDOC_VERSION%%.*}.$((${PYDOC_VERSION##*.}+1))
10586 git clone --depth 1 --single-branch --branch $newer_branch https://github.com/python/python-docs-pt-br ${newer_branch}-dir
106- pomerge --from ./${newer_branch}-dir/{**/,}*.po --to ./${{ env.LANGUAGE_DIR }}/{**/,}*.po
87+ pomerge --from ./${newer_branch}-dir/{**/,}*.po --to ./${{ env.PYDOC_LANG_DIR }}/{**/,}*.po
10788 rm -rf ./${newer_branch}-dir
10889
10990 - name : powrap
11091 if : steps.pull.outcome == 'success'
11192 run : |
112- cd ./${{ env.LANGUAGE_DIR }}
93+ cd ./${{ env.PYDOC_LANG_DIR }}
11394 powrap *.po **/*.po
11495
11596 - name : Update statistics
11697 if : always()
11798 run : |
11899 ./scripts/stats.py
119- git -C ./${{ env.LANGUAGE_DIR }} diff stats.json
100+ git -C ./${{ env.PYDOC_LANG_DIR }} diff stats.json
101+ env :
102+ PYDOC_LANG_DIR : ${{ env.PYDOC_LANG_DIR }}
120103
121104 - name : Update potodo.md
122105 if : always()
123106 run : |
124107 ./scripts/potodo.sh
125- git diff ./${{ env.LANGUAGE_DIR }}/potodo.md
108+ git -C ./${{ env.PYDOC_LANG_DIR }} diff potodo.md
109+ env :
110+ PYDOC_LANG_DIR : ${{ env.PYDOC_LANG_DIR }}
126111
127112 # 4- Commit and push translations
128113
129114 - name : Commit
130115 run : ./scripts/commit.sh
116+ env :
117+ PYDOC_LANG_DIR : ${{ env.PYDOC_LANG_DIR }}
131118
132119 - name : Push
133120 if : ${{ contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
134121 run : |
135- cd ./${{ env.LANGUAGE_DIR }}
122+ cd ./${{ env.PYDOC_LANG_DIR }}
136123 git push
137124
138125
0 commit comments