mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-12-12 10:37:02 +00:00
CI: Automate language file generation and syncing between the main and language repositories
This commit is contained in:
parent
08609591ae
commit
f840adaf7e
25 changed files with 118 additions and 56 deletions
10
.github/actions/get_mo_files/action.yml
vendored
Normal file
10
.github/actions/get_mo_files/action.yml
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
name: "Copy mo files from artifacts"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Copy mo files
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: mo-files
|
||||||
|
path: bin
|
||||||
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
|
|
@ -15,8 +15,12 @@ env:
|
||||||
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
|
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
generate-mo-files:
|
||||||
|
uses: ./.github/workflows/generate_mo_files.yml
|
||||||
|
|
||||||
build-ubuntu:
|
build-ubuntu:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
needs: generate-mo-files
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repo"
|
- name: "Checkout repo"
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -74,12 +78,15 @@ jobs:
|
||||||
|
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
run: mv bin/Cemu_release bin/Cemu
|
run: mv bin/Cemu_release bin/Cemu
|
||||||
|
|
||||||
|
- name: Copy MO files
|
||||||
|
uses: ./.github/actions/get_mo_files
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: cemu-bin-linux-x64
|
name: cemu-bin-linux-x64
|
||||||
path: ./bin/Cemu
|
path: ./bin
|
||||||
|
|
||||||
build-appimage:
|
build-appimage:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
@ -112,6 +119,7 @@ jobs:
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
|
needs: generate-mo-files
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout repo"
|
- name: "Checkout repo"
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -168,15 +176,19 @@ jobs:
|
||||||
|
|
||||||
- name: Prepare artifact
|
- name: Prepare artifact
|
||||||
run: Rename-Item bin/Cemu_release.exe Cemu.exe
|
run: Rename-Item bin/Cemu_release.exe Cemu.exe
|
||||||
|
|
||||||
|
- name: Copy MO files
|
||||||
|
uses: ./.github/actions/get_mo_files
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: cemu-bin-windows-x64
|
name: cemu-bin-windows-x64
|
||||||
path: ./bin/Cemu.exe
|
path: ./bin
|
||||||
|
|
||||||
build-macos:
|
build-macos:
|
||||||
runs-on: macos-14
|
runs-on: macos-14
|
||||||
|
needs: generate-mo-files
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
arch: [x86_64, arm64]
|
arch: [x86_64, arm64]
|
||||||
|
|
@ -185,7 +197,10 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: "recursive"
|
submodules: "recursive"
|
||||||
|
|
||||||
|
- name: Copy MO files
|
||||||
|
uses: ./.github/actions/get_mo_files
|
||||||
|
|
||||||
- name: Setup release mode parameters
|
- name: Setup release mode parameters
|
||||||
run: |
|
run: |
|
||||||
echo "BUILD_MODE=release" >> $GITHUB_ENV
|
echo "BUILD_MODE=release" >> $GITHUB_ENV
|
||||||
|
|
|
||||||
10
.github/workflows/deploy_release.yml
vendored
10
.github/workflows/deploy_release.yml
vendored
|
|
@ -113,10 +113,7 @@ jobs:
|
||||||
|
|
||||||
- name: Create release from windows-bin
|
- name: Create release from windows-bin
|
||||||
run: |
|
run: |
|
||||||
ls ./
|
mv cemu-bin-windows-x64 ./${{ env.CEMU_FOLDER_NAME }}
|
||||||
ls ./bin/
|
|
||||||
cp -R ./bin ./${{ env.CEMU_FOLDER_NAME }}
|
|
||||||
mv cemu-bin-windows-x64/Cemu.exe ./${{ env.CEMU_FOLDER_NAME }}/Cemu.exe
|
|
||||||
zip -9 -r upload/cemu-${{ env.CEMU_VERSION }}-windows-x64.zip ${{ env.CEMU_FOLDER_NAME }}
|
zip -9 -r upload/cemu-${{ env.CEMU_VERSION }}-windows-x64.zip ${{ env.CEMU_FOLDER_NAME }}
|
||||||
rm -r ./${{ env.CEMU_FOLDER_NAME }}
|
rm -r ./${{ env.CEMU_FOLDER_NAME }}
|
||||||
|
|
||||||
|
|
@ -129,10 +126,7 @@ jobs:
|
||||||
|
|
||||||
- name: Create release from linux-bin
|
- name: Create release from linux-bin
|
||||||
run: |
|
run: |
|
||||||
ls ./
|
mv cemu-bin-linux-x64 ./${{ env.CEMU_FOLDER_NAME }}
|
||||||
ls ./bin/
|
|
||||||
cp -R ./bin ./${{ env.CEMU_FOLDER_NAME }}
|
|
||||||
mv cemu-bin-linux-x64/Cemu ./${{ env.CEMU_FOLDER_NAME }}/Cemu
|
|
||||||
zip -9 -r upload/cemu-${{ env.CEMU_VERSION }}-ubuntu-22.04-x64.zip ${{ env.CEMU_FOLDER_NAME }}
|
zip -9 -r upload/cemu-${{ env.CEMU_VERSION }}-ubuntu-22.04-x64.zip ${{ env.CEMU_FOLDER_NAME }}
|
||||||
rm -r ./${{ env.CEMU_FOLDER_NAME }}
|
rm -r ./${{ env.CEMU_FOLDER_NAME }}
|
||||||
|
|
||||||
|
|
|
||||||
32
.github/workflows/generate_mo_files.yml
vendored
Normal file
32
.github/workflows/generate_mo_files.yml
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
name: Generate mo files
|
||||||
|
on: workflow_call
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
generate-mo-files:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Cemu-Language repo
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: Cemu-Project/Cemu-Language
|
||||||
|
path: Cemu-Language
|
||||||
|
|
||||||
|
- name: Install gettext
|
||||||
|
run: sudo apt-get install -y gettext
|
||||||
|
|
||||||
|
- name: Convert .po to .mo
|
||||||
|
working-directory: Cemu-Language
|
||||||
|
run: |
|
||||||
|
for po_file in $(find . -name "*.po"); do
|
||||||
|
mo_file="${po_file%.po}.mo"
|
||||||
|
msgfmt $po_file -o $mo_file || true # skip invalid .po files
|
||||||
|
done
|
||||||
|
mkdir mo-files
|
||||||
|
find -name "*.mo" | xargs cp --parents -t mo-files
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: mo-files
|
||||||
|
path: Cemu-Language/mo-files
|
||||||
43
.github/workflows/generate_pot.yml
vendored
43
.github/workflows/generate_pot.yml
vendored
|
|
@ -1,43 +0,0 @@
|
||||||
name: Generate translation template
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- "*.md"
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
- reopened
|
|
||||||
push:
|
|
||||||
paths-ignore:
|
|
||||||
- "*.md"
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
generate-pot:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: "Checkout repo"
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: "Install gettext"
|
|
||||||
run: |
|
|
||||||
sudo apt update -qq
|
|
||||||
sudo apt install -y gettext
|
|
||||||
|
|
||||||
- name: "Generate POT file using xgettext"
|
|
||||||
run: >
|
|
||||||
find src -name *.cpp -o -name *.hpp -o -name *.h |
|
|
||||||
xargs xgettext --from-code=utf-8 -w 100
|
|
||||||
--keyword="_" --keyword="wxTRANSLATE" --keyword="wxPLURAL:1,2"
|
|
||||||
--keyword="_tr" --keyword="TR_NOOP"
|
|
||||||
--check=space-ellipsis --omit-header
|
|
||||||
-o cemu.pot
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: POT file
|
|
||||||
path: ./cemu.pot
|
|
||||||
if-no-files-found: error
|
|
||||||
54
.github/workflows/update_language_repository.yml
vendored
Normal file
54
.github/workflows/update_language_repository.yml
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
name: Update language repository
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- "*.md"
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-language-repository:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout main repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
path: Cemu
|
||||||
|
|
||||||
|
- name: Install gettext
|
||||||
|
run: |
|
||||||
|
sudo apt update -qq
|
||||||
|
sudo apt install -y gettext
|
||||||
|
|
||||||
|
- name: Generate POT file using xgettext
|
||||||
|
working-directory: Cemu
|
||||||
|
run: >
|
||||||
|
find src -name *.cpp -o -name *.hpp -o -name *.h |
|
||||||
|
xargs xgettext --from-code=utf-8 -w 100
|
||||||
|
--keyword="_" --keyword="wxTRANSLATE" --keyword="wxPLURAL:1,2"
|
||||||
|
--keyword="_tr" --keyword="TR_NOOP"
|
||||||
|
--check=space-ellipsis --omit-header
|
||||||
|
-o cemu.pot
|
||||||
|
|
||||||
|
- name: Checkout language repo
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
repository: ${{ github.repository_owner }}/Cemu-Language
|
||||||
|
path: Cemu-Language
|
||||||
|
token: ${{ secrets.CI_CEMU_LANG_PUSH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Copy POT file
|
||||||
|
run: |
|
||||||
|
mkdir -p Cemu-Language/resources/en
|
||||||
|
cp Cemu/cemu.pot Cemu-Language/resources/en
|
||||||
|
|
||||||
|
- name: Commit and push POT file
|
||||||
|
run: |
|
||||||
|
cd Cemu-Language
|
||||||
|
git config user.name "Cemu-Language CI"
|
||||||
|
git config user.email "github-actions@github.com"
|
||||||
|
git add resources/en/cemu.pot
|
||||||
|
git commit -m "Update POT file" || exit 0 # Don't fail if no changes
|
||||||
|
git push
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue