|
| 1 | +name: Update crowdin sources |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + |
| 9 | +jobs: |
| 10 | + synchronize-with-crowdin: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + # Backend i18n |
| 17 | + - name: Install Python |
| 18 | + uses: actions/setup-python@v3 |
| 19 | + with: |
| 20 | + python-version: "3.12.6" |
| 21 | + - name: Upgrade pip and setuptools |
| 22 | + run: pip install --upgrade pip setuptools |
| 23 | + - name: Install development dependencies |
| 24 | + run: pip install --user . |
| 25 | + working-directory: src/backend |
| 26 | + - name: Install gettext |
| 27 | + run: | |
| 28 | + sudo apt-get update |
| 29 | + sudo apt-get install -y gettext pandoc |
| 30 | + - name: generate pot files |
| 31 | + working-directory: src/backend |
| 32 | + run: | |
| 33 | + DJANGO_CONFIGURATION=Build python manage.py compilemessages |
| 34 | + DJANGO_CONFIGURATION=Build python manage.py makemessages -a --keep-pot |
| 35 | + # frontend i18n |
| 36 | + - name: Setup Node.js |
| 37 | + uses: actions/setup-node@v4 |
| 38 | + with: |
| 39 | + node-version: "20.x" |
| 40 | + - name: Restore the frontend cache |
| 41 | + uses: actions/cache@v4 |
| 42 | + id: front-node_modules |
| 43 | + with: |
| 44 | + path: "src/frontend/**/node_modules" |
| 45 | + key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }} |
| 46 | + - name: Install dependencies |
| 47 | + if: steps.front-node_modules.outputs.cache-hit != 'true' |
| 48 | + run: cd src/frontend/ && yarn install --frozen-lockfile |
| 49 | + - name: Cache install frontend |
| 50 | + if: steps.front-node_modules.outputs.cache-hit != 'true' |
| 51 | + uses: actions/cache@v4 |
| 52 | + with: |
| 53 | + path: "src/frontend/**/node_modules" |
| 54 | + key: front-node_modules-${{ hashFiles('src/frontend/**/yarn.lock') }} |
| 55 | + - name: generate source translation file |
| 56 | + working-directory: src/frontend |
| 57 | + run: yarn i18n:extract |
| 58 | + # crowdin workflow |
| 59 | + - name: crowdin action |
| 60 | + uses: crowdin/github-action@v2 |
| 61 | + with: |
| 62 | + config: crowdin/config.yml |
| 63 | + upload_sources: true |
| 64 | + upload_translations: false |
| 65 | + download_translations: false |
| 66 | + create_pull_request: false |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + # A numeric ID, found at https://crowdin.com/project/<projectName>/tools/api |
| 70 | + CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} |
| 71 | + |
| 72 | + # Visit https://crowdin.com/settings#api-key to create this token |
| 73 | + CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
| 74 | + |
| 75 | + CROWDIN_BASE_PATH: "../src/" |
0 commit comments