diff --git a/.github/workflows/ja-full-translation-google.yaml b/.github/workflows/ja-full-translation-google.yaml new file mode 100644 index 0000000000000..3cb4c3f3e19da --- /dev/null +++ b/.github/workflows/ja-full-translation-google.yaml @@ -0,0 +1,76 @@ +name: JA Full Translation (Google version) + +jobs: + ja-translation: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + name: Download translator repo + with: + repository: "shczhen/markdown-translator" + path: "markdown-translator" + - uses: actions/checkout@v3 + name: Download specified branch of docs repo + with: + ref: "release-7.5" + path: "docs" + - uses: actions/setup-node@v3 + name: Setup node 18 + with: + node-version: 18 + + - run: | + sudo apt install tree -y + + - name: Copy doc files to translator folder + run: | + cp -r docs markdown-translator/markdowns + rm -rf markdown-translator/markdowns/.github + rm -rf markdown-translator/markdowns/scripts + rm -rf markdown-translator/markdowns/media + + - name: Config and translate + run: | + cd markdown-translator + echo ${{secrets.GCP_KEY}} | base64 --decode >> key.json + export GOOGLE_APPLICATION_CREDENTIALS=key.json + export PROJECT_ID=${{ secrets.GCP_PROJECT_ID }} + export GLOSSARY_ID=${{ secrets.GCP_GLOSSARY_ID }} + yarn + node src/index.js + cd .. + - name: Copy translated files to docs repo + run: | + cd docs + git checkout -b i18n-ja-release-7.5 + cd .. + cp -r markdown-translator/output/markdowns/* docs/ + + - name: Git commit and push + run: | + cd docs + git config user.name github-actions + git config user.email github-actions@github.com + git add . + if git status | grep -q "Changes to be committed" + then + git commit -m "Update full translated files for JA" + else + echo "No changes detected, skipped" + fi + git push + + dispatch: + runs-on: ubuntu-latest + needs: [ja-translation] + + steps: + - name: trigger docs-staging workflow + run: | + curl \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: token ${{ secrets.DOCS_STAGING }}" \ + https://api.github.com/repos/pingcap/docs-staging/actions/workflows/update.yml/dispatches \ + -d '{"ref":"main","inputs":{"full": "false", "repo":"${{ github.repository }}","branch":"i18n-ja-release-7.5"}}'