Skip to content

🌎 Update project translations #227

🌎 Update project translations

🌎 Update project translations #227

name: 🌎 Update project translations
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name != 'workflow_call' }}
on:
push:
branches:
- main
paths:
- project/**
- '.github/workflows/project-translation.yml'
pull_request:
branches:
- main
paths:
- project/**
- '.github/workflows/project-translation.yml'
schedule:
- cron: "30 04 * * *"
workflow_dispatch:
workflow_call: # Allows this workflow to be called by other workflows
inputs:
release_tag:
required: false
description: 'Release tag to upload project translations as GitHub Release asset'
default: ''
type: string
jobs:
build:
name: Update project translations
runs-on: ubuntu-24.04
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
COMPOSE_PROFILES: qgis
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Transifex
working-directory: project
run: |
curl -OL https://github.com/transifex/cli/releases/download/v1.6.10/tx-linux-amd64.tar.gz
tar -xvzf tx-linux-amd64.tar.gz
- name: Start Docker compose
run: |
docker compose up --build -d
until docker compose exec db pg_isready -U postgres; do
echo "Waiting for PostgreSQL to be ready..."
sleep 2
done
docker compose exec db createdb -U postgres tww
docker compose exec db pum -vvv -s pg_tww -d datamodel install -p SRID 2056 --roles --grant
- name: Translate (create sources)
run: docker compose exec qgis sh -c 'xvfb-run /usr/src/project/scripts/project-translation-create-source.py /usr/src/project/teksi_wastewater.qgs'
- name: Push to TX
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
working-directory: project
run: ./tx push --source
- name: Compile Translations (fetch translated content)
working-directory: project
run: |
./tx pull -a
docker compose exec qgis sh -c '/usr/src/project/scripts/project-translation-compile.sh /usr/src/project/teksi_wastewater.qgs'
- uses: actions/upload-artifact@v5
with:
name: project-translations
path: project/teksi_wastewater*
if-no-files-found: error
- name: Zip project translations
run: zip -r project-translations.zip project/teksi_wastewater*
- name: Upload project translations as GitHub Release asset
if: ${{ inputs.release_tag != '' }}
run: |
gh release upload "${{ inputs.release_tag }}" project-translations.zip#oqtopus.project --repo "$GITHUB_REPOSITORY"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}