Update translations #1188
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: "Update translations" | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '38 2 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: git clone --depth=1 --branch snapshot https://github.com/folio-org/platform-complete build | |
| - run: cp build/yarn.lock . | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| cache: 'yarn' | |
| - name: Build translations | |
| run: | | |
| cd build | |
| yarn config set @folio:registry https://repository.folio.org/repository/npm-folio/ | |
| CXXFLAGS="-std=c++17" yarn install | |
| NODE_ENV=production yarn build output | |
| - name: Merge translations | |
| run: | | |
| cd platform-complete | |
| for oldfile in *.json ; do | |
| newfile=$(echo $oldfile | sed -E 's#(.+).json#\1-*.json#') | |
| newfile=$(echo ../build/output/translations/$newfile) | |
| if [ ! -e "$newfile" ] ; then | |
| echo "Skipping, not found: $newfile" | |
| continue | |
| fi | |
| jq -s --sort-keys '.[0] * .[1]' $oldfile $newfile > /tmp/new.json | |
| FILESIZE=$(stat -c%s /tmp/new.json) | |
| if [ "$FILESIZE" -lt "1000000" ] ; then | |
| echo "Skipping $LANG, file size must be >= 1000000 but it is $FILESIZE" | |
| continue | |
| fi | |
| mv /tmp/new.json $oldfile | |
| done | |
| cd .. | |
| mkdir upload | |
| mv platform-complete upload | |
| - uses: actions/upload-artifact@v6 | |
| with: | |
| name: platform-complete | |
| path: upload/ | |
| retention-days: 1 | |
| commit: | |
| needs: [update] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: rm -r platform-complete/ | |
| - uses: actions/download-artifact@v7 | |
| - name: Commit updates | |
| run: | | |
| git config --local user.name 'folio-translations repository bot' | |
| git config --local user.email 'folio-translations@users.noreply.github.com' | |
| git add platform-complete/ | |
| (git commit -m "Update translations" && git push) || true # ignore failure caused by unchanged files |