name: 🌎 Push Translations

on:
  push:
    branches:
      - master

jobs:
  translations:
    runs-on: ubuntu-22.04
    if: ${{ github.repository == 'opengisch/QField' }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Install Requirements
        run: |
          sudo apt-get update
          sudo apt-get install -y qttools5-dev-tools
          # v1.6.5: 2023-02-16
          curl -OL https://github.com/transifex/cli/releases/download/v1.6.5/tx-linux-amd64.tar.gz
          tar -xvzf tx-linux-amd64.tar.gz
          ./scripts/ci/env_gh.sh

      - name: "🌍 Push Translations"
        env:
          tx_token: ${{ secrets.TX_TOKEN }}
        run: TX_TOKEN=$tx_token ./scripts/ci/update-translations.sh
