Skip to content

Update translations #3213

Update translations

Update translations #3213

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: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
- name: Setup Nix cache
uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Prepare
run: |
git config --local user.email "[email protected]"
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
# create worktree for latest stable tag
git -C src worktree add -b stable ../src_stable $(git -C src rev-list --tags --max-count=1)
nix develop . -c ./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"