New guides #548
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Build Docusaurus | |
| on: | |
| pull_request: | |
| types: [labeled] | |
| paths: | |
| - 'docs/**/*.md' | |
| permissions: | |
| checks: write | |
| contents: write | |
| jobs: | |
| build-docusaurus: | |
| if: github.event.label.name == 'BUILD PERMISSION' | |
| timeout-minutes: 1440 | |
| runs-on: self-hosted | |
| steps: | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Fetch master branch for diff | |
| run: git fetch origin master | |
| - name: Install dependencies | |
| run: npm install | |
| working-directory: ${{ github.workspace }} | |
| - name: Translation process | |
| working-directory: ${{ github.workspace }} | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| TRANSLATION_PROMPT: ${{ secrets.TRANSLATION_PROMPT }} | |
| TRANSLATION_GLOSSARY: ${{ secrets.TRANSLATION_GLOSSARY }} | |
| run: node translate.js | |
| - name: Commit translations | |
| run: | | |
| git config --local user.name "github-actions" | |
| git config --local user.email "github-actions@github.com" | |
| git add -A i18n/ | |
| if ! git diff --cached --quiet; then | |
| git commit -m "Auto-translate docs" | |
| git push origin HEAD:${{ github.head_ref }} | |
| else | |
| echo "No translation changes to commit" | |
| fi | |
| - name: Build Docusaurus | |
| run: | | |
| npm run write-translations -- --locale de | |
| npm run write-translations -- --locale es | |
| npm run write-translations -- --locale fr | |
| npm run write-translations -- --locale ar | |
| npm run write-translations -- --locale pt | |
| npm run write-translations -- --locale th | |
| npm run write-translations -- --locale pl | |
| npm run write-translations -- --locale ja | |
| rm -rf build | |
| npm run docusaurus clear | |
| rm -f build.tar | |
| npm run build | |
| tar cf build.tar -C build --transform 's~^\./~~' . | |
| working-directory: ${{ github.workspace }} |