mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
workflows are armed now
This commit is contained in:
38
.github/workflows/compile-mo.yml
vendored
38
.github/workflows/compile-mo.yml
vendored
@@ -1,12 +1,11 @@
|
||||
name: Compile .mo files from changed .po files
|
||||
|
||||
on:
|
||||
# push:
|
||||
# paths:
|
||||
# - '**/*.po'
|
||||
# branches:
|
||||
# - 'dev'
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- '**/*.po'
|
||||
branches:
|
||||
- 'dev'
|
||||
|
||||
jobs:
|
||||
compile_mo:
|
||||
@@ -17,7 +16,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: wavelog/wavelog
|
||||
ref: alpha
|
||||
ref: dev
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Set up gettext
|
||||
@@ -25,17 +24,28 @@ jobs:
|
||||
|
||||
- name: Compile .mo files from changed .po files
|
||||
run: |
|
||||
for po in $(git diff --name-only HEAD~1 HEAD | grep '\.po$'); do
|
||||
mo="${po%.po}.mo";
|
||||
msgfmt --verbose -o "$mo" "$po";
|
||||
done
|
||||
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"
|
||||
git add .
|
||||
git commit -m "Compiled .mo file"
|
||||
git push
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
git add $(git ls-files --modified | grep '\.mo$')
|
||||
git commit -m "Compiled .mo files"
|
||||
git push
|
||||
else
|
||||
echo "No changes to commit"
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
26
.github/workflows/translation.yml
vendored
26
.github/workflows/translation.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Translation Workflow
|
||||
name: Run the PO generator script
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -12,36 +12,20 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: wavelog/wavelog
|
||||
ref: alpha
|
||||
ref: dev
|
||||
|
||||
- name: Set up gettext
|
||||
run: sudo apt-get install -y gettext
|
||||
|
||||
- name: Create POT file
|
||||
run: xgettext --no-wrap -o assets/lang_src/messages.pot --copyright-holder=Wavelog --from-code=UTF-8 --keyword=__ --keyword=_ngettext:1,2 --keyword=_pgettext:1c,2 -L PHP $(find . -name "*.php")
|
||||
|
||||
- name: Merge POT into PO files
|
||||
run: |
|
||||
for po in $(find . -name "*.po"); do
|
||||
msgmerge --no-wrap -UN --verbose "$po" assets/lang_src/messages.pot;
|
||||
done
|
||||
|
||||
- name: Delete backup .po~ files
|
||||
run: find . -name "*.po~" -delete
|
||||
|
||||
- name: Compile MO files from PO files
|
||||
run: |
|
||||
for po in $(find . -name "*.po"); do
|
||||
mo="${po%.po}.mo";
|
||||
msgfmt --verbose -o "$mo" "$po";
|
||||
done
|
||||
- name: Run the PO generator script
|
||||
run: bash po_gen.sh
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config --global user.name "github-actions"
|
||||
git config --global user.email "github-actions@github.com"
|
||||
git add .
|
||||
git commit -m "Update translations"
|
||||
git commit -m "Run po_gen.sh script to update translations (manually triggered)"
|
||||
git push
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user