Release/2.11.8 #1087
Workflow file for this run
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: | |
pull_request: | |
types: [ opened, edited, reopened, ready_for_review, synchronize ] | |
branches: | |
- 'main' | |
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@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Setup workflow context | |
id: workflow | |
working-directory: ${{ runner.temp }} | |
env: | |
REPO: ${{ github.repository }} | |
run: | | |
mkdir dist | |
echo "DIST=${PWD}/dist" >> $GITHUB_OUTPUT | |
echo "PACKAGE=${REPO##*/}" >> $GITHUB_OUTPUT | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
coverage: none | |
tools: composer, cs2pr | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache Composer vendor directory | |
uses: actions/cache@v4 | |
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@v4 | |
with: | |
node-version: 20.x | |
- 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: Setup Registry | |
run: printf "\n//npm.pkg.github.com/:_authToken=${{ secrets.NEWFOLD_ACCESS_TOKEN }}" >> .npmrc | |
- name: NPM Install | |
run: npm install --legacy-peer-deps | |
- name: Build JavaScript | |
run: npm run build | |
- name: Remove token | |
run: git checkout -- '.npmrc' | |
- name: Add text domains | |
run: npx node-wp-i18n addtextdomain | |
- name: Generate language files | |
run: composer run-script i18n | |
- name: Check if there are file changes | |
id: changes | |
continue-on-error: true | |
run: git diff --exit-code | |
- name: Warning if language files have changes | |
if: steps.changes.outcome == 'failure' | |
run: | | |
echo "i18n files are out of date" | |
echo "Please run command (composer run i18n) locally to update them and commit before releasing" | |
- name: Commit web files | |
if: steps.changes.outcome == 'failure' | |
run: | | |
git config --local user.name "${{ github.event.head_commit.author.name || 'GitHub Action' }}" | |
git config --local user.email "${{ github.event.head_commit.author.email || 'action@github.com' }}" | |
git remote -v | |
git add -A | |
git commit -m "WordPress i18n triggered by commit ${{ github.sha }}" | |
git status | |
- name: Pull latest changes from remote branch | |
if: steps.changes.outcome == 'failure' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git fetch origin | |
git rebase origin/${{ github.event.pull_request.head.ref }} | |
- name: Push changes | |
if: steps.changes.outcome == 'failure' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: git push origin HEAD:${{ github.event.pull_request.head.ref }} |