Skip to content

Commit c5d2087

Browse files
committed
Update Transifex workflow to specify Python version and enhance dependency installation
1 parent 3eb0be2 commit c5d2087

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

.github/workflows/transifex-pull.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,32 @@ jobs:
2020
access_token: ${{ secrets.GITHUB_TOKEN }}
2121
- uses: actions/setup-python@master
2222
with:
23-
python-version: 3
23+
python-version: '3.12'
2424
- name: Install Dependencies
2525
run: |
26-
sudo apt-get install -y gettext
26+
set -euxo pipefail
27+
sudo apt-get update
28+
sudo apt-get install -y gettext curl tar
29+
python -m pip install --upgrade pip
2730
pip install requests cogapp polib transifex-python sphinx-intl blurb six
28-
curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash
29-
working-directory: /usr/local/bin
31+
32+
# Install tx deterministically with retries instead of piping installer script.
33+
TX_URL="https://github.com/transifex/cli/releases/latest/download/tx-linux-amd64.tar.gz"
34+
curl -fL --retry 5 --retry-delay 2 --retry-connrefused "$TX_URL" -o /tmp/tx.tar.gz
35+
tar -xzf /tmp/tx.tar.gz -C /tmp
36+
sudo install -m 0755 /tmp/tx /usr/local/bin/tx
37+
command -v tx
38+
tx --version
3039
- uses: actions/checkout@master
3140
with:
3241
ref: ${{ matrix.version }}
3342
fetch-depth: 0
34-
- run: curl -O https://raw.githubusercontent.com/python-docs-translations/transifex-automations/master/sample-workflows/transifex-util.py
43+
- run: curl -fL -o transifex-util.py https://raw.githubusercontent.com/python-docs-translations/transifex-automations/master/sample-workflows/transifex-util.py
3544
- run: chmod +x transifex-util.py
45+
- name: Patch helper for cross-version Doc Makefile compatibility
46+
run: |
47+
sed -i 's|_call("make -C cpython/Doc/ gettext")|_call("make -C cpython/Doc/ JOBS=1 gettext || make -C cpython/Doc/ JOBS=1 build BUILDER=gettext")|' transifex-util.py
48+
grep -n "JOBS=1" transifex-util.py
3649
- run: ./transifex-util.py recreate_tx_config --language ru --project-slug python-newest --version ${{ matrix.version }}
3750
env:
3851
TX_TOKEN: ${{ secrets.TX_TOKEN }}
@@ -53,9 +66,9 @@ jobs:
5366
&& echo "SIGNIFICANT_CHANGES=1" >> $GITHUB_ENV || exit 0
5467
- run: git add . ':!transifex-util.py'
5568
- run: git commit -m 'Update translation from Transifex'
56-
if: env.SIGNIFICANT_CHANGES
69+
if: env.SIGNIFICANT_CHANGES == '1'
5770
- uses: ad-m/github-push-action@master
58-
if: env.SIGNIFICANT_CHANGES
71+
if: env.SIGNIFICANT_CHANGES == '1'
5972
with:
6073
branch: ${{ matrix.version }}
61-
github_token: ${{ secrets.GITHUB_TOKEN }}
74+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)