From e7f7de3f54b6a9280358c3f963c015a69b03e272 Mon Sep 17 00:00:00 2001 From: KirCute <951206789@qq.com> Date: Tue, 30 Dec 2025 16:50:08 +0800 Subject: [PATCH 1/3] ci(lang): manual sync to crowdin --- .github/actions/sync_to_crowdin/action.yml | 28 ++++++++++++++++++++ .github/workflows/i18n_sync.yml | 25 +---------------- .github/workflows/manual_sync_to_crowdin.yml | 18 +++++++++++++ 3 files changed, 47 insertions(+), 24 deletions(-) create mode 100644 .github/actions/sync_to_crowdin/action.yml create mode 100644 .github/workflows/manual_sync_to_crowdin.yml diff --git a/.github/actions/sync_to_crowdin/action.yml b/.github/actions/sync_to_crowdin/action.yml new file mode 100644 index 000000000..e6f94993c --- /dev/null +++ b/.github/actions/sync_to_crowdin/action.yml @@ -0,0 +1,28 @@ +name: Sync i18n to Crowdin + +runs: + using: "composite" + steps: + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version: "22" + registry-url: "https://registry.npmjs.org" + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + # version: 9.9.0 + run_install: false + + - name: Install dependencies + shell: bash + run: pnpm install + + - name: Sync to Crowdin + shell: bash + run: | + pnpm crowdin:upload + env: + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} diff --git a/.github/workflows/i18n_sync.yml b/.github/workflows/i18n_sync.yml index 016456b73..ef8be1463 100644 --- a/.github/workflows/i18n_sync.yml +++ b/.github/workflows/i18n_sync.yml @@ -83,31 +83,8 @@ jobs: git push fi - - name: Setup Node - if: steps.verify-changed-files.outputs.changed == 'true' - uses: actions/setup-node@v6 - with: - node-version: "22" - registry-url: "https://registry.npmjs.org" - - - name: Install pnpm - if: steps.verify-changed-files.outputs.changed == 'true' - uses: pnpm/action-setup@v4 - with: - # version: 9.9.0 - run_install: false - - - name: Install dependencies - if: steps.verify-changed-files.outputs.changed == 'true' - run: pnpm install - - name: Sync to Crowdin - if: steps.verify-changed-files.outputs.changed == 'true' - run: | - pnpm crowdin:upload - env: - CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} + uses: ./.github/actions/sync_to_crowdin permissions: contents: write diff --git a/.github/workflows/manual_sync_to_crowdin.yml b/.github/workflows/manual_sync_to_crowdin.yml new file mode 100644 index 000000000..101b34760 --- /dev/null +++ b/.github/workflows/manual_sync_to_crowdin.yml @@ -0,0 +1,18 @@ +name: Manual sync i18n to Crowdin + +on: + workflow_dispatch: + +jobs: + run_sync: + name: Run sync + runs-on: ubuntu-latest + steps: + - name: Checkout frontend codes + uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: recursive + + - name: Sync to Crowdin + uses: ./.github/actions/sync_to_crowdin From 273f63bb34f8eae0528ff3ea256329c2a06973e1 Mon Sep 17 00:00:00 2001 From: KirCute <951206789@qq.com> Date: Tue, 30 Dec 2025 17:00:22 +0800 Subject: [PATCH 2/3] fix --- .github/actions/sync_to_crowdin/action.yml | 12 ++++++++++-- .github/workflows/i18n_sync.yml | 3 +++ .github/workflows/manual_sync_to_crowdin.yml | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/actions/sync_to_crowdin/action.yml b/.github/actions/sync_to_crowdin/action.yml index e6f94993c..61266e096 100644 --- a/.github/actions/sync_to_crowdin/action.yml +++ b/.github/actions/sync_to_crowdin/action.yml @@ -1,5 +1,13 @@ name: Sync i18n to Crowdin +inputs: + crowdin_project_id: + required: true + description: "Crowdin Project ID" + crowdin_personal_token: + required: true + description: "Crowdin Personal Token" + runs: using: "composite" steps: @@ -24,5 +32,5 @@ runs: run: | pnpm crowdin:upload env: - CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} - CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} + CROWDIN_PROJECT_ID: ${{ inputs.crowdin_project_id }} + CROWDIN_PERSONAL_TOKEN: ${{ inputs.crowdin_personal_token }} diff --git a/.github/workflows/i18n_sync.yml b/.github/workflows/i18n_sync.yml index ef8be1463..f9ccf58cd 100644 --- a/.github/workflows/i18n_sync.yml +++ b/.github/workflows/i18n_sync.yml @@ -85,6 +85,9 @@ jobs: - name: Sync to Crowdin uses: ./.github/actions/sync_to_crowdin + with: + crowdin_project_id: ${{ secrets.CROWDIN_PROJECT_ID }} + crowdin_personal_token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} permissions: contents: write diff --git a/.github/workflows/manual_sync_to_crowdin.yml b/.github/workflows/manual_sync_to_crowdin.yml index 101b34760..00ca67cb0 100644 --- a/.github/workflows/manual_sync_to_crowdin.yml +++ b/.github/workflows/manual_sync_to_crowdin.yml @@ -16,3 +16,6 @@ jobs: - name: Sync to Crowdin uses: ./.github/actions/sync_to_crowdin + with: + crowdin_project_id: ${{ secrets.CROWDIN_PROJECT_ID }} + crowdin_personal_token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} From 7666690a3735ce8d88d9f2da8ce3c1ae6f4d7ce6 Mon Sep 17 00:00:00 2001 From: KirCute <951206789@qq.com> Date: Tue, 30 Dec 2025 17:15:51 +0800 Subject: [PATCH 3/3] ci: add sync to crowdin condition --- .github/workflows/i18n_sync.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/i18n_sync.yml b/.github/workflows/i18n_sync.yml index f9ccf58cd..784b29a87 100644 --- a/.github/workflows/i18n_sync.yml +++ b/.github/workflows/i18n_sync.yml @@ -84,6 +84,7 @@ jobs: fi - name: Sync to Crowdin + if: ${{ steps.verify-changed-files.outputs.changed == 'true' || github.event_name == 'push' }} uses: ./.github/actions/sync_to_crowdin with: crowdin_project_id: ${{ secrets.CROWDIN_PROJECT_ID }}