From 7ac084d71a07d22f7d70e299c750629df4fb49fc Mon Sep 17 00:00:00 2001 From: SternXD Date: Tue, 26 May 2026 04:37:03 -0400 Subject: [PATCH] CI: Add Crowdin CI sync workflow --- .github/workflows/crowdin.yml | 66 +++++++++++++++++++++++++++++++++++ crowdin.yml | 8 +++++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/crowdin.yml diff --git a/.github/workflows/crowdin.yml b/.github/workflows/crowdin.yml new file mode 100644 index 00000000..a9a441c9 --- /dev/null +++ b/.github/workflows/crowdin.yml @@ -0,0 +1,66 @@ +name: Crowdin Sync + +on: + schedule: + - cron: '0 0 * * *' # Every day at midnight UTC. + workflow_dispatch: + +concurrency: + group: crowdin-sync + cancel-in-progress: false + +jobs: + crowdin: + runs-on: ubuntu-latest + timeout-minutes: 20 + + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Install Node + uses: actions/setup-node@v6 + with: + node-version: 24 + + - name: Install Crowdin CLI + run: npm install -g @crowdin/cli@4.14.2 + + - name: Upload source strings + run: crowdin upload sources + env: + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + + - name: Download translations + run: crowdin download + env: + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + + - name: Detect translation changes + id: changes + run: | + if git diff --quiet -- src/ui/Translations; then + echo "has_changes=false" >> "$GITHUB_OUTPUT" + else + echo "has_changes=true" >> "$GITHUB_OUTPUT" + fi + + - name: Create Pull Request + if: steps.changes.outputs.has_changes == 'true' + uses: peter-evans/create-pull-request@v8 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: crowdin/translations + delete-branch: true + commit-message: "[ci skip] Update translations" + title: "translations: sync Crowdin translations" + body: | + Automated translation sync from Crowdin. \ No newline at end of file diff --git a/crowdin.yml b/crowdin.yml index 15f0c39c..7eae45f6 100644 --- a/crowdin.yml +++ b/crowdin.yml @@ -1,5 +1,13 @@ +project_id_env: CROWDIN_PROJECT_ID +api_token_env: CROWDIN_PERSONAL_TOKEN + +base_path: . + +preserve_hierarchy: true + pull_request_title: 'translations: sync Crowdin translations' commit_message: '[ci skip]' + files: - source: /src/ui/Translations/myMCpp_en.ts translation: /src/ui/Translations/myMCpp_%locale%.ts