Merge pull request #136 from newfold-labs/version-bump-1.2.4 #841
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: WP Internationalization | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
types: [opened, edited, synchronize, reopened, ready_for_review] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
wp-i18n: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup workflow context | |
id: workflow | |
working-directory: ${{ runner.temp }} | |
env: | |
REPO: ${{ github.repository }} | |
run: | | |
mkdir dist | |
echo ::set-output name=DIST::${PWD}/dist | |
echo ::set-output name=PACKAGE::${REPO##*/} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "7.4" | |
coverage: none | |
tools: composer | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Cache Composer vendor directory | |
uses: actions/cache@v2 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
- name: Setup Node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Log debug information | |
run: | | |
php --version | |
composer --version | |
node --version | |
npm --version | |
- name: Validate composer.json and composer.lock files | |
run: composer validate | |
- name: Install PHP Dependencies | |
run: composer install --no-progress --optimize-autoloader | |
- name: Add text domains | |
run: npx node-wp-i18n addtextdomain | |
- name: Run NPM Install | |
run: npm install | |
- name: Build dist | |
run: npm run build | |
- name: Generate POT file | |
run: vendor/bin/wp i18n make-pot . ./languages/${{ github.event.repository.name }}.pot --headers='{"Report-Msgid-Bugs-To":"https://github.com/${{ github.repository }}/issues","POT-Creation-Date":null}' --exclude=node_modules,tests | |
- name: Check if there are file changes | |
id: changes | |
run: echo "::set-output name=changed::$(git status --porcelain | wc -l)" | |
- name: Commit web files | |
if: steps.changes.outputs.changed != 0 | |
run: | | |
git config --local user.name "${{ github.event.head_commit.author.name }}" | |
git config --local user.email "${{ github.event.head_commit.author.email }}" | |
git remote -v | |
git add -A | |
git commit -m "WordPress I18N triggered by commit ${{ github.sha }}" | |
git status | |
- name: Push changes | |
if: steps.changes.outputs.changed != 0 | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |