Translated using Weblate (Chinese (Simplified Han script)) #53
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: Auto-Translate with Weblate | |
| on: | |
| push: | |
| branches: [ main, test-build ] | |
| jobs: | |
| # runs on weblate commit | |
| weblate-commit-build: | |
| if: ${{ contains(github.event.head_commit.message, 'Translated using Weblate') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: TODO - start full build (delayed) | |
| run: echo "TODO - start delayed full build, maybe 15mins?" | |
| # on regular commit -> .pot/.po pushed by main repo | |
| full-build: | |
| if: ${{ ! contains(github.event.head_commit.message, 'Translated using Weblate') }} | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| runs-on: ubuntu-latest | |
| #container: | |
| # image: sphinxdoc/sphinx | |
| # #options: --user 1001 (only if we don't need apt-get) | |
| env: | |
| MAIN_LANGS: en | |
| OTHER_LANGS: de es fr ru nl it ja el bg da et fi lv lt pl pt ro sv sk sl cs hu zh_CN | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| #- name: Checkout source repository | |
| # uses: actions/checkout@v4 | |
| # with: | |
| # repository: nitrokey/nitrokey-documentation | |
| # path: source.git | |
| #- name: Install additional python packages | |
| # run: | | |
| # make -C source.git venv | |
| # ln -s source.git/venv venv | |
| - name: Weblate - pull component repository | |
| run: bash trigger_weblate.sh ${{ secrets.WEBLATE_API_URL }} none ${{ secrets.WEBLATE_TOKEN }} pull | |
| - name: Weblate - force wait hoping for weblate to settle | |
| run: sleep 180 | |
| # - name: Checkout Sources | |
| # uses: actions/checkout@v4 | |
| # with: | |
| # repository: nitrokey/nitrokey-documentation | |
| # path: source.git | |
| - name: Weblate - trigger automated translations | |
| shell: bash | |
| run: | | |
| for lang in $OTHER_LANGS | |
| do | |
| bash trigger_weblate.sh ${{ secrets.WEBLATE_API_URL }} $lang ${{ secrets.WEBLATE_TOKEN }} translate | |
| done | |
| - name: Weblate - push to upstream | |
| run: bash trigger_weblate.sh ${{ secrets.WEBLATE_API_URL }} none ${{ secrets.WEBLATE_TOKEN }} push | |
| # - name: WORKAROUND - revert replace double backslashes in .po files | |
| # shell: bash | |
| # run: | | |
| # sed -ie 's@/bs/@\\\\@g' $(find locales -name "*.po" | xargs) | |
| # - name: Build full docs (all languages) | |
| # run: | | |
| # cp -r locales source.git/source/locales | |
| # for lang in $MAIN_LANGS $OTHER_LANGS | |
| # do | |
| # mkdir -p dist/$lang | |
| # mkdir -p build/$lang/doctrees | |
| # sphinx-build -j auto -b html -D language=$lang -d build/$lang/doctrees source.git/source dist/$lang | |
| # done | |
| # - name: Cleanup before packing, pack only one _images | |
| # shell: bash | |
| # run: | | |
| # mv dist/en/_images dist | |
| # for lang in $MAIN_LANGS $OTHER_LANGS | |
| # do | |
| # rm -rf dist/$lang/_sources dist/$lang/_images | |
| # done | |
| # - name: Upload full build artifact | |
| # id: upload-full | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: generated documentation (all) | |
| # path: dist | |
| # - name: Trigger docs server to download and deploy full documentation | |
| # uses: appleboy/ssh-action@v1.2.0 | |
| # with: | |
| # host: ${{ secrets.DOCS_HOST }} | |
| # username: docs | |
| # port: ${{ secrets.DOCS_PORT }} | |
| # key: ${{ secrets.DEPLOY_AUTH_KEY }} | |
| # script: /var/www/docs/deploy/github-trigger.sh all ${{ steps.upload-full.outputs.artifact-id }} ${{ secrets.DOWNLOAD_TOKEN }} | |