Skip to content

Commit

Permalink
Migrate to new Transifex CLI (CleverRaven#54892)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrettDong authored Jan 30, 2022
1 parent 1bba9b7 commit 0ef1066
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 39 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/pull-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ jobs:
if: github.repository == 'CleverRaven/Cataclysm-DDA'
runs-on: ubuntu-20.04
steps:
- name: "Install dependencies"
- name: "Install Transifex CLI"
run: |
sudo apt-get update
sudo apt-get install gettext python3-pip
sudo pip3 install transifex-client
curl -s https://github.com/transifex/cli/releases/download/v1.0.0/tx-linux-amd64.tar.gz | sudo tar zxvf - -C /usr/bin tx
- name: "Checkout"
uses: actions/checkout@v2
- name: "Get current date"
Expand All @@ -23,15 +21,8 @@ jobs:
format: 'DD MMMM YYYY'
- name: "Pull translations"
env:
TOKEN: ${{ secrets.TX_TOKEN }}
run: |
export TX_TOKEN=$TOKEN
rm lang/po/*.po
until tx pull -a
do
echo "Retry in 10 seconds..."
sleep 10
done
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: tx pull
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
Expand Down
27 changes: 6 additions & 21 deletions .github/workflows/push-translation-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,17 @@ jobs:
github.event.workflow_run.conclusion == 'success' &&
github.repository == 'CleverRaven/Cataclysm-DDA' }}
steps:
- name: "Install dependencies"
- name: "Install gettext tools"
run: sudo apt install gettext
- name: "Install Transifex CLI"
run: |
sudo apt-get update
sudo apt-get install gettext python3-pip
sudo pip3 install transifex-client polib
curl -s https://github.com/transifex/cli/releases/download/v1.0.0/tx-linux-amd64.tar.gz | sudo tar zxvf - -C /usr/bin tx
- name: "Checkout"
uses: actions/checkout@v2
- name: "Generate translation template"
run: |
lang/update_pot.sh
- name: "Set up Transifex token"
- name: "Push translation template to Transifex server"
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
run: |
cat << EOF > ~/.transifexrc
[https://www.transifex.com]
api_hostname = https://api.transifex.com
hostname = https://www.transifex.com
password = $TX_TOKEN
username = api
EOF
- name: "Push translation template to Transifex server"
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
retry_on: error
command: |
tx push --source --no-interactive --resource cataclysm-dda.master-cataclysm-dda
run: tx push -s
11 changes: 6 additions & 5 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[main]
host = https://www.transifex.com

[cataclysm-dda.master-cataclysm-dda]
file_filter = lang/po/<lang>.po
[o:cataclysm-dda-translators:p:cataclysm-dda:r:master-cataclysm-dda]
file_filter = lang/po/<lang>.po
source_file = lang/po/cataclysm-dda.pot
source_lang = en
type = PO
minimum_perc = 0
source_file = lang/po/cataclysm-dda.pot
source_lang = en
type = PO

0 comments on commit 0ef1066

Please sign in to comment.