Skip to content

Update translations #2843

Update translations

Update translations #2843

Workflow file for this run

name: Update translations
on:
schedule:
- cron: '0 */6 * * *' # https://crontab.guru/#0_*/12_*_*_*
workflow_dispatch: # allow manual trigger
push:
branches:
- master
paths-ignore:
- '**.ts'
jobs:
lock-weblate:
runs-on: ubuntu-latest
container:
image: weblate/wlc
options: "-u root:root"
steps:
- name: Lock Weblate
run: |
mkdir -p ~/.config
echo "${{ secrets.WEBLATE_CONFIG }}" > ~/.config/weblate
wlc commit "prismlauncher/launcher"
sleep 1
wlc lock "prismlauncher/launcher"
update:
needs: lock-weblate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Prepare
run: |
sudo apt-get update
sudo apt-get install -y qt6-l10n-tools gettext
git config --local user.email "gitbot@scrumplex.net"
git config --local user.name "PrismAutomata"
- name: Ensure updated translations
run: |
# pull latest translations manually to avoid conflicts
git pull # maybe Weblate already pushed their changes
git remote add weblate https://hosted.weblate.org/git/prismlauncher/launcher
git remote update
git merge weblate/master
- name: Update translations
run: |
git clone https://github.com/PrismLauncher/PrismLauncher.git src
export LUPDATE_BIN="/usr/lib/qt6/bin/lupdate"
./update.sh
- name: Commit files
run: |
git commit -m "Update source strings" -a || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
unlock-weblate:
needs: update
if: ${{ always() }} # ensure that this runs, even if something failed
runs-on: ubuntu-latest
container:
image: weblate/wlc
options: "-u root:root"
steps:
- name: Unlock Weblate
run: |
mkdir -p ~/.config
echo "${{ secrets.WEBLATE_CONFIG }}" > ~/.config/weblate
wlc pull "prismlauncher/launcher" || wlc pull "prismlauncher/launcher"
sleep 1
wlc unlock "prismlauncher/launcher" || wlc unlock "prismlauncher/launcher"