diff --git a/.github/actions/sync_to_crowdin/action.yml b/.github/actions/sync_to_crowdin/action.yml new file mode 100644 index 000000000..61266e096 --- /dev/null +++ b/.github/actions/sync_to_crowdin/action.yml @@ -0,0 +1,36 @@ +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: + - 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: ${{ 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 016456b73..784b29a87 100644 --- a/.github/workflows/i18n_sync.yml +++ b/.github/workflows/i18n_sync.yml @@ -83,31 +83,12 @@ 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 }} + 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 }} + 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 new file mode 100644 index 000000000..00ca67cb0 --- /dev/null +++ b/.github/workflows/manual_sync_to_crowdin.yml @@ -0,0 +1,21 @@ +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 + with: + crowdin_project_id: ${{ secrets.CROWDIN_PROJECT_ID }} + crowdin_personal_token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}