1-
21name : Push Translations to Transifex
32
43on :
@@ -58,16 +57,35 @@ jobs:
5857 python -m pip install requests cogapp polib transifex-python sphinx-intl blurb six
5958
6059 - name : Install Transifex CLI
60+ shell : bash
6161 run : |
62- curl -fsSL https://raw.githubusercontent.com/transifex/cli/master/install.sh \
63- | bash -s -- "v${TX_CLI_VERSION}"
64- command -v tx
65- tx --version
62+ set -euo pipefail
63+
64+ mkdir -p "$RUNNER_TEMP/txcli"
65+
66+ curl -fsSL \
67+ "https://github.com/transifex/cli/releases/download/v${TX_CLI_VERSION}/tx-linux-amd64.tar.gz" \
68+ -o "$RUNNER_TEMP/txcli/tx.tar.gz"
69+
70+ tar -xzf "$RUNNER_TEMP/txcli/tx.tar.gz" -C "$RUNNER_TEMP/txcli"
71+
72+ TX_BINARY="$(find "$RUNNER_TEMP/txcli" -type f -name tx -print -quit)"
73+ if [ -z "$TX_BINARY" ]; then
74+ echo "ERROR: Transifex CLI binary was not found in the archive."
75+ find "$RUNNER_TEMP/txcli" -maxdepth 3 -type f -print
76+ exit 1
77+ fi
78+
79+ sudo install -m 0755 "$TX_BINARY" /usr/local/bin/tx
80+ echo "/usr/local/bin" >> "$GITHUB_PATH"
81+
82+ /usr/local/bin/tx --version
6683
6784 - name : Generate Transifex configuration
6885 run : |
6986 curl -fsSLO https://raw.githubusercontent.com/python-docs-translations/transifex-automations/main/sample-workflows/transifex-util.py
7087 chmod +x transifex-util.py
88+
7189 ./transifex-util.py recreate_tx_config \
7290 --language "$TX_LANGUAGE" \
7391 --project-slug "$TX_PROJECT" \
@@ -111,7 +129,9 @@ jobs:
111129 for resource in sorted(expected):
112130 section = resources[resource]
113131 source = config.get(section, "source_file", fallback="").strip()
114- if source != f"gettext/{resource.replace('--', '/')}.pot":
132+ expected_source = f"gettext/{resource.replace('--', '/')}.pot"
133+
134+ if source != expected_source:
115135 raise SystemExit(
116136 f"ERROR: unexpected source_file for {resource}: {source}"
117137 )
@@ -123,7 +143,10 @@ jobs:
123143 env :
124144 TX_TOKEN : ${{ secrets.TX_TOKEN }}
125145 run : |
126- tx push --translation --languages "$TX_LANGUAGE" --use-git-timestamps
146+ /usr/local/bin/tx push \
147+ --translation \
148+ --languages "$TX_LANGUAGE" \
149+ --use-git-timestamps
127150
128151 push-sources :
129152 name : Generate and push source templates
@@ -158,20 +181,24 @@ jobs:
158181 python -m pip install requests cogapp polib transifex-python sphinx-intl blurb six
159182
160183 - name : Install Transifex CLI
161- env :
162- TX_CLI_VERSION : ${{ env.TX_CLI_VERSION }}
184+ shell : bash
163185 run : |
164186 set -euo pipefail
165187
166188 mkdir -p "$RUNNER_TEMP/txcli"
189+
167190 curl -fsSL \
168191 "https://github.com/transifex/cli/releases/download/v${TX_CLI_VERSION}/tx-linux-amd64.tar.gz" \
169192 -o "$RUNNER_TEMP/txcli/tx.tar.gz"
170193
171194 tar -xzf "$RUNNER_TEMP/txcli/tx.tar.gz" -C "$RUNNER_TEMP/txcli"
172195
173196 TX_BINARY="$(find "$RUNNER_TEMP/txcli" -type f -name tx -print -quit)"
174- test -n "$TX_BINARY"
197+ if [ -z "$TX_BINARY" ]; then
198+ echo "ERROR: Transifex CLI binary was not found in the archive."
199+ find "$RUNNER_TEMP/txcli" -maxdepth 3 -type f -print
200+ exit 1
201+ fi
175202
176203 sudo install -m 0755 "$TX_BINARY" /usr/local/bin/tx
177204 echo "/usr/local/bin" >> "$GITHUB_PATH"
@@ -189,6 +216,7 @@ jobs:
189216 run : |
190217 curl -fsSLO https://raw.githubusercontent.com/python-docs-translations/transifex-automations/main/sample-workflows/transifex-util.py
191218 chmod +x transifex-util.py
219+
192220 ./transifex-util.py recreate_tx_config \
193221 --language "$TX_LANGUAGE" \
194222 --project-slug "$TX_PROJECT" \
@@ -207,6 +235,7 @@ jobs:
207235 raise SystemExit("ERROR: .tx/config was not generated")
208236
209237 missing = []
238+
210239 for section in config.sections():
211240 source = config.get(section, "source_file", fallback="").strip()
212241 if source and not Path(source).is_file():
@@ -224,4 +253,4 @@ jobs:
224253 env :
225254 TX_TOKEN : ${{ secrets.TX_TOKEN }}
226255 run : |
227- tx push --source --skip
256+ /usr/local/bin/ tx push --source --skip
0 commit comments