2020 PYDOC_LANGUAGE : pt_BR
2121 PYDOC_TX_PROJECT : ${{ inputs.tx_project }}
2222 PYDOC_VERSION : ${{ inputs.version }}
23+ PYDOC_LANG_DIR : ${{ inputs.version }}
2324 TX_CLI_VERSION : ' 1.6.17'
2425
2526jobs :
2627 sync :
2728 runs-on : ubuntu-latest
29+ permissions :
30+ contents : read
2831 steps :
2932
3033 # 1- Set up environment
3134
3235 - name : Check out this repository
3336 uses : actions/checkout@v6
3437
35- - name : Set language dir variable
36- run :
37- echo "PYDOC_LANG_DIR=${{ env.PYDOC_VERSION }}" >> $GITHUB_ENV
38-
3938 - name : Checkout this repository ${{ env.PYDOC_VERSION }}
4039 uses : actions/checkout@v6
4140 with :
@@ -107,7 +106,53 @@ jobs:
107106 env :
108107 PYDOC_LANG_DIR : ${{ env.PYDOC_LANG_DIR }}
109108
110- # 4- Commit and push translations
109+ - name : Upload translation artifacts
110+ uses : actions/upload-artifact@v7
111+ with :
112+ name : python-${{ env.PYDOC_VERSION }}
113+ path : |
114+ .tx/config
115+ potodo.md
116+ stats.json
117+ *.po
118+ **/*.po
119+
120+ commit :
121+ runs-on : ubuntu-latest
122+ needs : sync
123+ permissions :
124+ contents : write
125+ steps :
126+
127+ # 1- Set up environment
128+
129+ - name : Check out this repository
130+ uses : actions/checkout@v6
131+
132+ - name : Checkout this repository ${{ env.PYDOC_VERSION }}
133+ uses : actions/checkout@v6
134+ with :
135+ ref : ${{ env.PYDOC_VERSION }}
136+ path : ${{ env.PYDOC_LANG_DIR }}
137+
138+ - uses : actions/setup-python@v6
139+ with :
140+ python-version : ${{ inputs.version }}
141+ allow-prereleases : true
142+ cache : ' pip'
143+ pip-install : -r requirements.txt
144+
145+ # 2- Remove PO files and the download files (excluding obsolete)
146+
147+ - name : Clean PO files
148+ run : find ${{ env.PYDOC_LANG_DIR }} -name '*.po' | xargs -r rm
149+
150+ - name : Download translation artifacts
151+ uses : actions/download-artifact@v8
152+ with :
153+ name : python-${{ env.PYDOC_VERSION }}
154+
155+ # 3- Commit and push changed files depending on the event name
111156
112157 - name : Commit
113158 run : ./scripts/commit.sh
@@ -119,5 +164,3 @@ jobs:
119164 run : |
120165 cd ./${{ env.PYDOC_LANG_DIR }}
121166 git push
122-
123-
0 commit comments