Update translations to 66aeecb. #75
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: Update Translations | |
| on: | |
| push: | |
| branches: | |
| main | |
| defaults: | |
| run: | |
| shell: bash # https://github.com/beeware/briefcase/pull/912 | |
| env: | |
| FORCE_COLOR: "1" | |
| jobs: | |
| update-translations: | |
| name: Update Translations | |
| if: github.actor != 'brutusthebee' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/[email protected] | |
| with: | |
| fetch-depth: 1 | |
| token: ${{ secrets.BRUTUS_PAT_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/[email protected] | |
| with: | |
| python-version: "3.X" | |
| cache: pip | |
| cache-dependency-path: | | |
| pyproject.toml | |
| .pre-commit-config.yaml | |
| - name: Update pip | |
| run: python -m pip install -U pip | |
| - name: Install tox | |
| run: python -m pip install --group 'dev' | |
| - name: Configure git | |
| run: | | |
| git config --local user.email "$(git log --pretty='%ae' -1)" | |
| git config --local user.name "brutusthebee[bot]" | |
| - name: Configure Weblate | |
| env: | |
| WEBLATE_API_TOKEN: ${{ secrets.WEBLATE_API_TOKEN }} | |
| run: | | |
| cat <<EOF > ~/.weblate | |
| [weblate] | |
| url = https://hosted.weblate.org/api/ | |
| key = $WEBLATE_API_TOKEN | |
| translation = beeware/tutorial | |
| EOF | |
| - name: Lock Weblate and Sync | |
| run: wlc lock | |
| - name: Commit Weblate changes | |
| run: wlc commit | |
| - name: Push Weblate changes | |
| run: wlc push | |
| - name: Pull translation updates pushed by Weblate | |
| run: git pull origin | |
| - name: Regenerate PO files | |
| env: | |
| DEEPL_API_KEY: ${{ secrets.DEEPL_API_KEY }} | |
| run: | | |
| tox -e docs-translate | |
| - name: Update Needed? | |
| id: updated | |
| run: | | |
| if [[ $(git status --porcelain) ]]; then | |
| echo "updated=true" >> ${GITHUB_OUTPUT} | |
| else | |
| echo "updated=false" >> ${GITHUB_OUTPUT} | |
| fi | |
| - name: Commit updated translations | |
| if: steps.updated.outputs.updated == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| run: | | |
| # Commit the updated PO files. | |
| git add docs/locales | |
| git commit -m "Update translations to $(git rev-parse --short HEAD)." | |
| git push origin | |
| - name: Ensure Weblate has current updates | |
| if: steps.updated.outputs.updated == 'true' | |
| run: wlc pull | |
| - name: Unlock Weblate | |
| run: wlc unlock | |
| # # This step is only needed if you're trying to diagnose test failures that | |
| # # only occur in CI, and can't be reproduced locally. When it runs, it will | |
| # # open an SSH server (URL reported in the logs) so you can ssh into the CI | |
| # # machine. | |
| # - name: Setup tmate session | |
| # uses: mxschmitt/action-tmate@v3 | |
| # if: failure() |