Update Qt .ts files #22
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 Qt .ts files | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 1 * * 1' | |
jobs: | |
update-translations: | |
runs-on: ubuntu-24.04 | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Get latest workflow run ID | |
id: get-run-id | |
run: | | |
RUN_ID=$(curl -s -H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/RPCS3/rpcs3/actions/workflows/qt-ts.yml/runs?per_page=1" \ | |
| jq -r '.workflow_runs[0].id') | |
echo "Latest run ID: $RUN_ID" | |
echo "run-id=$RUN_ID" >> $GITHUB_OUTPUT | |
- name: Download template artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: RPCS3_Translation_Template | |
path: template/ | |
repository: RPCS3/rpcs3 | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
run-id: ${{ steps.get-run-id.outputs.run-id }} | |
- name: Install Qt Tools | |
run: | | |
sudo apt update | |
sudo apt install -y qt6-l10n-tools | |
- name: Update translations | |
run: | | |
LUPDATE_PATH=$(find /usr -name lupdate -type f 2>/dev/null | head -n 1) | |
if [ -z "$LUPDATE_PATH" ]; then | |
echo "Error: lupdate not found!" | |
exit 1 | |
else | |
echo "lupdate found at: $LUPDATE_PATH" | |
for ts_file in translations/*.ts; do | |
$LUPDATE_PATH template/rpcs3_template.ts -no-obsolete -ts "$ts_file" | |
done | |
fi | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add template/rpcs3_template.ts translations/ | |
git commit -m "Update translations based on latest template" | |
git push |