diff --git a/.github/workflows/translations-upload.yml b/.github/workflows/translations-upload.yml new file mode 100644 index 000000000..1e96236eb --- /dev/null +++ b/.github/workflows/translations-upload.yml @@ -0,0 +1,58 @@ +name: 'Extract and upload translations' + +on: + workflow_dispatch: + workflow_call: + # Disabled until i18n PR is landed. + # push: + # branches: ['main'] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + extract_translations: + name: Extract and upload translations + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + + - uses: ./.github/actions/node-install + + - name: Extract and compile translations + run: | + npm run translate:extract + npm run translate:compile + + - name: Check and commit any files created + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@documenso.com' + git add packages/lib/translations + git diff --staged --quiet --exit-code || (git commit -m "chore: extract translations" && git push) + + - name: Compile translations + id: compile_translations + run: npm run translate:compile -- -- --strict + continue-on-error: true + + - name: Upload missing translations + if: ${{ steps.compile_translations.outcome == 'failure' }} + uses: crowdin/github-action@v2 + with: + upload_sources: true + upload_translations: true + download_translations: false + localization_branch_name: chore/translations + env: + # A numeric ID, found at https://crowdin.com/project//tools/api + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + + # Visit https://crowdin.com/settings#api-key to create this token + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}