From ffbf3f1fa6b7ff7ccd14db643dc6ced77cd37ad4 Mon Sep 17 00:00:00 2001 From: Ned Zimmerman Date: Mon, 6 Jun 2022 20:09:39 -0300 Subject: [PATCH] ci: use wp-cli i18n command instead of pb-cli (#335) * ci: use wp-cli i18n command instead of pb-cli * Use PHP 7.4 * ci: use wp-cli/wp-cli-bundle Co-authored-by: Steel Wagstaff --- .github/workflows/update-pot.yml | 28 +++++++++++------------ .github/workflows/update-translations.yml | 23 +++++++++++++------ 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/.github/workflows/update-pot.yml b/.github/workflows/update-pot.yml index afc6f01..fbba5a6 100644 --- a/.github/workflows/update-pot.yml +++ b/.github/workflows/update-pot.yml @@ -16,20 +16,18 @@ jobs: - name: Setup PHP with tools uses: shivammathur/setup-php@v2 with: - php-version: '7.3' - tools: composer, wp-cli - - name: Install dependencies - run: | - wp package install wp-cli/i18n-command:2.2.8 - cd /home/runner/.wp-cli/packages/ - composer config repositories.wp-cli '{"type": "composer","url": "https://wp-cli.org/package-index/","canonical": false}' - cd ./ - wp package install pressbooks/pb-cli:2.1.0 - composer require jenssegers/blade:1.1.0 + php-version: '7.4' + tools: composer, wp-cli/wp-cli-bundle - name: Update POT file - run: wp pb make-pot . languages/pressbooks-aldine.pot --require=vendor/autoload.php --domain=pressbooks-aldine --slug=pressbooks-aldine --package-name="Aldine" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/pressbooks/pressbooks-aldine/issues\"}" - - name: Commit updated POT file - uses: stefanzweifel/git-auto-commit-action@v4.13.1 + run: wp i18n make-pot . languages/pressbooks-aldine.pot --domain=pressbooks-aldine --slug=pressbooks-aldine --package-name="Aldine" --headers="{\"Report-Msgid-Bugs-To\":\"https://github.com/pressbooks/pressbooks-aldine/issues\"}" + # Remove this step once you are satisfied with the results; alternatively, you can leave it in place and remove + # the commented out step that follows. + - name: Open PR with changes + uses: peter-evans/create-pull-request@v4 with: - commit_message: 'chore(l10n): update languages/pressbooks-aldine.pot' - file_pattern: '*.pot' + title: 'chore(l10n): update languages/pressbooks-aldine.pot' + # - name: Commit updated POT file + # uses: stefanzweifel/git-auto-commit-action@v4.1.1 + # with: + # commit_message: 'chore(l10n): update languages/pressbooks-aldine.pot' + # file_pattern: '*.pot' diff --git a/.github/workflows/update-translations.yml b/.github/workflows/update-translations.yml index 7c4cd21..0f06488 100644 --- a/.github/workflows/update-translations.yml +++ b/.github/workflows/update-translations.yml @@ -15,12 +15,21 @@ jobs: run: tx pull --all --force --minimum-perc=25 env: TX_TOKEN: ${{ secrets.TX_TOKEN }} - - name: Install xgettext - run: sudo apt-get install -y gettext + - name: Setup PHP with tools + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + tools: composer, wp-cli/wp-cli-bundle - name: Generate MO files - run: for file in languages/*.po ; do msgfmt $file -o `echo $file | sed 's/\(.*\.\)po/\1mo/'` ; done - - name: Commit updated translation files - uses: stefanzweifel/git-auto-commit-action@v4.13.1 + run: wp i18n make-mo languages + # Remove this step once you are satisfied with the results; alternatively, you can leave it in place and remove + # the commented out step that follows. + - name: Open PR with changes + uses: peter-evans/create-pull-request@v4 with: - commit_message: 'chore(l10n): update translations' - file_pattern: '*.mo *.po' + title: 'chore(l10n): update translations' + # - name: Commit updated translation files + # uses: stefanzweifel/git-auto-commit-action@v4.13.1 + # with: + # commit_message: 'chore(l10n): update translations' + # file_pattern: '*.mo'