OTA translations #546
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OTA translations | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| # Every day at 10:11 UTC | |
| - cron: '11 10 * * *' | |
| jobs: | |
| build-ota-translations: | |
| name: Build OTA translations | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install GNU gettext | |
| run: sudo apt-get install gettext | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| cache-dependency-glob: "scripts/check-translations.py" | |
| - name: Install Crowdin CLI | |
| run: npm i -g @crowdin/cli | |
| - name: Download latest translations from Crowdin | |
| run: | | |
| echo 'api_token: "${{secrets.CROWDIN_PERSONAL_TOKEN}}"' >>crowdin.yaml | |
| crowdin download | |
| rm crowdin.yaml | |
| - name: Build OTA updates | |
| run: scripts/build-ota-translations.sh | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ota-update | |
| path: ota-update.tar | |
| - name: Upload OTA updates | |
| run: | | |
| VERSION=$(sed -n -e 's/.*POEDIT_VERSION_SHORT.* "\(.*\)".*/\1/p' src/version.h) | |
| echo "OTA version: $VERSION" | |
| curl --fail-with-body -F "version=$VERSION" -F "data=@ota-update.tar" -H "X-Api-Key: ${{secrets.OTA_API_KEY}}" ${{vars.OTA_UPLOAD_ENDPOINT}} >response | |
| cat response | |
| modified=$(echo `jq -r '.modified[]' < response`) | |
| if [ -n "$modified" ] ; then | |
| echo "::notice title=Translations updated::Updated files: $modified" | |
| else | |
| echo "::notice title=No updates::No translations were updated." | |
| fi | |
| - name: Check for PO compilation errors | |
| run: | | |
| if [ -f ota-had-errors ]; then | |
| echo "::warning::Some strings were removed from OTA translations due to errors." | |
| exit 1 | |
| fi |