prompt fix #21
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: Readme Translator (Multilingual) | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - 'README.md' | |
| permissions: | |
| contents: write | |
| jobs: | |
| # JOB 1: Western Languages (Faster, ~11 mins) | |
| translate-western: | |
| name: Western (${{ matrix.lang }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # If one language fails, let the others finish | |
| matrix: | |
| lang: [de, fr, es, pt] # German, French, Spanish, Portuguese | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache Model Weights | |
| id: cache-model | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./models | |
| key: aya-expanse-8b-q4ks-v4 | |
| - name: Install Dependencies | |
| run: | | |
| pip install llama-cpp-python | |
| mkdir -p models | |
| - name: Download Aya Expanse Translation Model | |
| if: steps.cache-model.outputs.cache-hit != 'true' | |
| run: | | |
| # Downloading Aya Expanse 8B (Q4_K_S) for multilingual technical translation | |
| wget -O models/aya-expanse-8b-q4_k_s.gguf https://huggingface.co/matrixportalx/aya-expanse-8b-Q4_K_S-GGUF/resolve/main/aya-expanse-8b-q4_k_s.gguf | |
| - name: Run Translation Script | |
| run: python scripts/translate.py --lang ${{ matrix.lang }} | |
| - name: Upload Translation Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: western-readme-${{ matrix.lang }} | |
| path: locales/README.${{ matrix.lang }}.md | |
| commit-western: | |
| needs: translate-western | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Download Western Translations | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: western-readme-* | |
| path: locales | |
| merge-multiple: true | |
| - name: Commit and Push (Western) | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add locales/*.md | |
| git commit -m "docs: update western translations (DE, FR, ES, PT)" || echo "No changes to commit" | |
| # Retry logic to handle race conditions if Eastern finishes at the same time | |
| for i in {1..5}; do | |
| git pull --rebase | |
| if git push; then exit 0; fi | |
| echo "Push failed, retrying in 5s..." | |
| sleep 5 | |
| done | |
| exit 1 | |
| # JOB 2: Eastern/Complex Languages (Slower, ~17 mins) | |
| translate-eastern: | |
| name: Eastern (${{ matrix.lang }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lang: [ja, zh, ko, hi] # Japanese, Chinese, Korean, Hindi | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache Model Weights | |
| id: cache-model | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./models | |
| key: aya-expanse-8b-q4ks-v4 | |
| - name: Install Dependencies | |
| run: | | |
| pip install llama-cpp-python | |
| mkdir -p models | |
| - name: Download Aya Expanse TL Model | |
| if: steps.cache-model.outputs.cache-hit != 'true' | |
| run: | | |
| # Downloading Aya Expanse 8B (Q4_K_S) for multilingual technical translation | |
| wget -O models/aya-expanse-8b-q4_k_s.gguf https://huggingface.co/matrixportalx/aya-expanse-8b-Q4_K_S-GGUF/resolve/main/aya-expanse-8b-q4_k_s.gguf | |
| - name: Run Translation Script | |
| run: python scripts/translate.py --lang ${{ matrix.lang }} | |
| - name: Upload Translation Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: eastern-readme-${{ matrix.lang }} | |
| path: locales/README.${{ matrix.lang }}.md | |
| commit-eastern: | |
| needs: translate-eastern | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Download Eastern Translations | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: eastern-readme-* | |
| path: locales | |
| merge-multiple: true | |
| - name: Commit and Push (Eastern) | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add locales/*.md | |
| git commit -m "docs: update eastern translations (JA, ZH, KO, HI)" || echo "No changes to commit" | |
| for i in {1..5}; do | |
| git pull --rebase | |
| if git push; then exit 0; fi | |
| echo "Push failed, retrying in 5s..." | |
| sleep 5 | |
| done | |
| exit 1 |