Repository navigation
81 lines (70 loc) · 2.84 KB
/
Copy pathpush_i18n_source.yml
File metadata and controls
81 lines (70 loc) · 2.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: push_i18n_source
# Extract the i18n source (src/locale/messages.xlf) from the code and push it to
# Transifex, so new/changed strings reach translators.
#
# messages.xlf is generated, not committed (see .gitignore). Translations come
# back through pull-translations.yml, which opens a PR from the `transifex`
# branch.
#
# Runs on main only, from bld_test_rel_tag.yml.
permissions:
contents: read
on:
workflow_call:
secrets:
TRANSIFEX_TOKEN:
required: false
description: Transifex API token, used by `tx push -s`.
workflow_dispatch:
jobs:
push_i18n_source:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
TX_TOKEN: ${{ secrets.TRANSIFEX_TOKEN }}
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: audit
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: ./.github/actions/yarn-install
# scripts/environment.runtime.js is generated and gitignored, and the build
# target that extract-i18n compiles lists it as a global script. Generating
# it first, as `yarn build`'s prebuild does, keeps extraction independent of
# whether the builder tolerates a missing script file. Two seconds.
- run: yarn build-runtime-env
# ng extract-i18n + scripts/normalize-xlf.prebuild.ts.
# Writes src/locale/messages.xlf and the xx/lr/rl test languages.
- run: yarn build:i18n
- name: Install Transifex CLI
env:
# Pinned: the upstream install.sh always fetches the newest release, so
# an unrelated tx release could change behaviour on any run. This job
# holds a token with push rights.
TX_CLI_VERSION: '1.6.17'
run: |
mkdir -p "$HOME/bin"
curl -sSfL -o /tmp/tx.tar.gz \
"https://github.com/transifex/cli/releases/download/v${TX_CLI_VERSION}/tx-linux-amd64.tar.gz"
tar -xzf /tmp/tx.tar.gz -C /tmp tx
install -m 0755 /tmp/tx "$HOME/bin/tx"
echo "$HOME/bin" >> "$GITHUB_PATH"
export PATH="$HOME/bin:$PATH"
tx --version
- name: Configure Transifex credentials
run: |
if [ -z "${TX_TOKEN:-}" ]; then
echo "TRANSIFEX_TOKEN secret is not set" >&2
exit 1
fi
mkdir -p "$HOME"
printf "%s\n" \
"[https://app.transifex.com]" \
"hostname = https://app.transifex.com" \
"api_hostname = https://api.transifex.com" \
"token = ${TX_TOKEN}" > "$HOME/.transifexrc"
chmod 600 "$HOME/.transifexrc"
echo "Created ~/.transifexrc"
- name: Push source file to Transifex
run: TX_CONFIG=.tx/config tx push -s -r orcid-angular.messages-xlf