mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
name: Compile .mo files from changed .po files
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
# paths:
|
|
# - '**/*.po'
|
|
# branches:
|
|
# - 'dev'
|
|
|
|
jobs:
|
|
compile_mo:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: wavelog/wavelog
|
|
ref: dev
|
|
fetch-depth: 2
|
|
|
|
- name: Set up gettext
|
|
run: sudo apt-get install -y gettext
|
|
|
|
- name: Compile .mo files from changed .po files
|
|
run: |
|
|
set -e
|
|
changed_po_files=$(git diff --name-only HEAD~1 HEAD | grep '\.po$' || true)
|
|
if [ -n "$changed_po_files" ]; then
|
|
for po in $changed_po_files; do
|
|
mo="${po%.po}.mo"
|
|
msgfmt -vv -o "$mo" "$po"
|
|
echo "Compiled $po to $mo"
|
|
done
|
|
else
|
|
echo "No .po files changed"
|
|
fi
|
|
|
|
- name: Commit changes
|
|
run: |
|
|
git config --global user.name "github-actions"
|
|
git config --global user.email "github-actions@github.com"
|
|
if [ -n "$(git status --porcelain)" ]; then
|
|
git add $(git ls-files --modified | grep '\.mo$')
|
|
git commit -m "Compiled .mo files (manually triggered)"
|
|
git push
|
|
else
|
|
echo "No changes to commit"
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|