name: Transifex
on:
  push:
    branches: [master, ]
permissions:
    contents: read # to fetch code (actions/checkout)

jobs:
    Push-To-Transifex:
        name: Update translations on Transifex
        if: github.repository == 'kovidgoyal/calibre'
        runs-on: ubuntu-latest
        container:
            image: 'archlinux/archlinux:latest'
            env:
                CI: 'true'
        steps:
            - name: Setup container
              run: |
                pacman -Syu --noconfirm
                pacman -S --noconfirm tar

            - name: Checkout source code
              uses: actions/checkout@master
              with:
                fetch-depth: 2

            - name: Install calibre dependencies
              run: setup/arch-ci.sh

            - name: Bootstrap calibre
              run: runuser -u ci -- python setup.py bootstrap --ephemeral

            - name: Update translations
              env:
                tx: ${{ secrets.tx }}
              run: |
                  runuser -u ci -- python setup/unix-ci.py pot
