@@ -37,40 +37,31 @@ jobs:
3737 - run : |
3838 sudo apt install tree -y
3939
40- - name : Download files by comparing commits
40+ - name : Download files
41+ uses : pingcap/docs-toolkit/actions/file-diff-update@main
42+ with :
43+ config_file : latest_translation_commit.json
44+ working_directory : docs
45+ filter_by_cloud_toc : ' true'
46+ files : ${{ inputs.file_names }}
47+
48+ - name : Show tmp directory structure
4149 run : |
42- export GH_TOKEN=${{github.token}}
4350 cd docs
44- npm i
45- if [ -n "${{ inputs.file_names }}" ]; then
46- node scripts/fetchFiles.js --files "${{ inputs.file_names }}"
47- else
48- node scripts/filterUpdateFiles.js --cloud
49- fi
50- tree tmp
51- cd ..
52- - name : Copy new files to translator folder
53- run : |
54- cp -r docs/tmp docs-toolkit/markdown-translator/markdowns
55- - name : Copy variables.json to translator folder
56- run : |
57- cp docs/variables.json docs-toolkit/markdown-translator/markdowns/variables.json
58- if [ -f docs/tmp/variables.json ]; then
59- cp docs/tmp/variables.json docs-toolkit/markdown-translator/markdowns/variables.json
60- cp docs/tmp/variables.json docs/variables.json
61- fi
51+ tree tmp || find tmp -type f | head -20
6252 - name : Config and translate
6353 run : |
6454 cd docs-toolkit/markdown-translator
55+ yarn
56+ cd ../..
57+ echo ${{secrets.GCP_KEY}} | base64 --decode >> key.json
58+ export GOOGLE_APPLICATION_CREDENTIALS=key.json
59+ export PROJECT_ID=${{ secrets.GCP_PROJECT_ID }}
60+ export GLOSSARY_ID=${{ secrets.GCP_GLOSSARY_ID }}
6561 export LANGLINK_ACCESS_KEY=${{ secrets.LANGLINK_ACCESS_KEY }}
6662 export LANGLINK_ACCESS_SECRET=${{ secrets.LANGLINK_ACCESS_SECRET }}
6763 export LANGLINK_USER=${{ secrets.LANGLINK_USER }}
68- yarn
69- node src/index.js
70- cd ..
71- - name : Copy translated files to docs repo
72- run : |
73- cp -r docs-toolkit/markdown-translator/output/markdowns/* docs/
64+ node docs-toolkit/markdown-translator/src/index.js --input-dir docs/tmp --output-dir docs/
7465
7566 - name : Set build ID
7667 id : build_id
0 commit comments