|
| 1 | + |
| 2 | +name: Update translations (Miyoo) |
| 3 | + |
| 4 | +on: |
| 5 | + # Run nightly: 8am UTC (only on Saturday) <- use POSIX cron syntax |
| 6 | + schedule: |
| 7 | + - cron: '0 8 * * 6' |
| 8 | + # Or run this workflow manually from the Actions tab |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-native: |
| 13 | + name: Nightly Translations update (miyoo) |
| 14 | + # only run on the main repo; forks can pull changes from there |
| 15 | + if: ${{ github.repository == 'MiyooCFW/gmenu2x' }} |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + token: ${{ secrets.GH_PAT }} |
| 21 | + - name: install dependencies (unifdef) |
| 22 | + run: | |
| 23 | + sudo apt-get update \ |
| 24 | + && sudo apt-get install unifdef |
| 25 | + - name: update dictionary.txt |
| 26 | + run: | |
| 27 | + (grep -o -rn . -P -e "\ttr\["[^]]*"\]" ; \ |
| 28 | + grep -o -rn . -e '>tr\["[^]]*"\]\|(tr\["[^]]*"\]\|\+tr\["[^]]*"\]\|\ tr\["[^]]*"\]\|,tr\["[^]]*"\]') | \ |
| 29 | + sed 's/.*\[\(.*\)\].*/\1/' | \ |
| 30 | + sed 's/\"\(.*\)\"/\1=/' | \ |
| 31 | + sed ':a;N;$!ba;s/\\n/ /g' | \ |
| 32 | + tr -d '\\' | sort | uniq \ |
| 33 | + > dictionary.txt |
| 34 | + - name: update translate.txt (miyoo) |
| 35 | + run: | |
| 36 | + ./tools/gen_translate.sh miyoo_defines miyoo |
| 37 | + - name: clean & update ALL ./assets/translations/* |
| 38 | + run: | |
| 39 | + ./tools/clean_translations.sh ALL |
| 40 | + - name: Check for git status |
| 41 | + id: status |
| 42 | + run: | |
| 43 | + echo "changes=$(git status -z --porcelain)" >> $GITHUB_OUTPUT |
| 44 | + - name: Push update changes |
| 45 | + if: ${{ steps.status.outputs.changes }} |
| 46 | + run: | |
| 47 | + git config user.email "action@github.com" |
| 48 | + git config user.name "GitHub Actions" |
| 49 | + git status |
| 50 | + git commit -am "Update Translations' files $(date)" |
| 51 | + git push |
0 commit comments