From 88d79d09f431141484502706a60dafc5abcf42fc Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 12 Jul 2024 22:53:39 +0200 Subject: [PATCH] workflow adjustments to reduce commits --- .github/workflows/compile-mo.yml | 51 ------------------------------- .github/workflows/translation.yml | 24 ++++++++++----- install/po_gen_installer.sh | 5 +++ po_gen.sh | 5 +++ 4 files changed, 27 insertions(+), 58 deletions(-) delete mode 100644 .github/workflows/compile-mo.yml mode change 100755 => 100644 install/po_gen_installer.sh mode change 100755 => 100644 po_gen.sh diff --git a/.github/workflows/compile-mo.yml b/.github/workflows/compile-mo.yml deleted file mode 100644 index a07aed3c8..000000000 --- a/.github/workflows/compile-mo.yml +++ /dev/null @@ -1,51 +0,0 @@ -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 }} diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index c34e62216..fc8ee47bc 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -20,18 +20,28 @@ jobs: - name: Set up gettext run: sudo apt-get install -y gettext - - name: Run the po generator script - run: bash po_gen.sh - - - name: Run the po generator script for the installer component aswell - run: bash install/po_gen_installer.sh + - name: Run all po_gen scripts + run: | + ./po_gen.sh + ./install/po_gen_installer.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 "Run po_gen.sh script to update translation files" + git commit -m "po/mo updates" git push env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Command Weblate to perform a pull + env: + WEBLATE_TOKEN: ${{ secrets.WEBLATE_TOKEN }} + WEBLATE_URL: ${{ secrets.WEBLATE_URL }} + run: | + sleep 2 + curl --silent \ + -d operation=pull \ + -H "Authorization: Token $WEBLATE_TOKEN" \ + $WEBLATE_URL \ No newline at end of file diff --git a/install/po_gen_installer.sh b/install/po_gen_installer.sh old mode 100755 new mode 100644 index fa188f3c7..5d32206ba --- a/install/po_gen_installer.sh +++ b/install/po_gen_installer.sh @@ -35,6 +35,11 @@ POT_COPYRIGHT_TEXT="Copyright (c) $YEAR Wavelog by DF2ET, DJ7NT, HB9HIL and LA8A POT_LICENCE_TEXT="This file is distributed under the MIT licence." FOLDERS="install" +echo "####################################################" +echo " " +echo "Performing the PO Generator Script for the Installer" +echo " " + # Find all PHP files and create a list in a temporary file find $FOLDERS -name "*.php" > PHPFILESLIST diff --git a/po_gen.sh b/po_gen.sh old mode 100755 new mode 100644 index 5e99a81a2..af4b758d1 --- a/po_gen.sh +++ b/po_gen.sh @@ -35,6 +35,11 @@ POT_COPYRIGHT_TEXT="Copyright (c) $YEAR Wavelog by DF2ET, DJ7NT, HB9HIL and LA8A POT_LICENCE_TEXT="This file is distributed under the MIT licence." FOLDERS="application assets src system" +echo "####################################################" +echo " " +echo "Performing the PO Generator Script for the Main Code" +echo " " + # Find all PHP files and create a list in a temporary file find $FOLDERS -name "*.php" > PHPFILESLIST