feat: 添加 Crowdin bootstrap 工作流以支持目标翻译的初始化上传

This commit is contained in:
春河晴
2026-03-13 04:54:47 +09:00
parent 67b559200d
commit 89bd4ba13a
4 changed files with 268 additions and 98 deletions

View File

@@ -1,6 +1,7 @@
<!-- 提交前必读 -->
- ✅ 接受与main直接相关的Bug修复提交到dev分支
- 新增功能类pr需要经过issue提前讨论否则不会被合并
- 🌐 i18n 提醒:除 bootstrap 或紧急修复外,请不要把非 `zh-CN` 目标翻译作为常规 GitHub 编辑面;常规翻译以 Crowdin -> `l10n_*` PR 回流为准,详见 `docs/i18n.md`
# 请填写以下内容
(删除掉中括号内的空格,并替换为**小写的x**

64
.github/workflows/crowdin-bootstrap.yml vendored Normal file
View File

@@ -0,0 +1,64 @@
name: Crowdin Bootstrap Target Translations
on:
workflow_dispatch:
inputs:
base_branch:
description: "Repository branch whose committed target translations should be bootstrapped into Crowdin."
required: true
type: choice
options:
- main
- r-dev
confirm_bootstrap:
description: "Explicit confirmation for the one-time or exceptional bootstrap upload."
required: true
type: choice
options:
- "no"
- "yes-bootstrap-current-target-translations"
permissions:
contents: read
jobs:
bootstrap-target-translations:
runs-on: ubuntu-24.04
steps:
- name: Require explicit bootstrap confirmation
if: inputs.confirm_bootstrap != 'yes-bootstrap-current-target-translations'
run: |
echo "This workflow uploads committed target translations into Crowdin." >&2
echo "Re-run it with confirm_bootstrap=yes-bootstrap-current-target-translations when you really want the bootstrap path." >&2
exit 1
- uses: actions/checkout@v4
with:
ref: ${{ inputs.base_branch }}
- name: Bootstrap committed target translations into Crowdin
uses: crowdin/github-action@v2
with:
config: crowdin.yml
skip_ref_checkout: true
upload_sources: true
upload_translations: true
download_translations: false
create_pull_request: false
env:
GITHUB_TOKEN: ${{ github.token }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
- name: Summarize bootstrap outcome
env:
BASE_BRANCH: ${{ inputs.base_branch }}
run: |
{
echo "## Crowdin bootstrap completed"
echo
echo "- Bootstrapped committed target-locale files from \`${BASE_BRANCH}\` into Crowdin."
echo "- This workflow is for one-time or exceptional seeding only."
echo "- The steady-state sync path remains \`crowdin-sync.yml\`, which uploads only \`zh-CN\` source assets on normal push-triggered runs and returns translations through \`l10n_${BASE_BRANCH}\` pull requests."
} >> "$GITHUB_STEP_SUMMARY"