Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b1351c4
refactor: move to github actions
miguelpeixe Jan 22, 2026
558b5a1
fix: let the script create the db
miguelpeixe Jan 22, 2026
656cf67
fix: release workflow
miguelpeixe Jan 22, 2026
ed7a28c
fix: post-release workflow
miguelpeixe Jan 22, 2026
991821b
fix: i18n workflow
miguelpeixe Jan 22, 2026
41b03ee
fix: i18n exclude src dir
miguelpeixe Jan 23, 2026
025ea16
fix(i18n): increase php nesting level
miguelpeixe Jan 23, 2026
3a37606
fix: create xdebug dir
miguelpeixe Jan 23, 2026
172cc5d
fix: remove custom config
miguelpeixe Jan 23, 2026
9849321
fix: alternate custom config strategy
miguelpeixe Jan 23, 2026
74d2c85
fix: label char limit
miguelpeixe Jan 23, 2026
37a87cc
fix: release command
miguelpeixe Jan 23, 2026
bfa681b
fix: post release vars and release asset
miguelpeixe Jan 23, 2026
704b6ee
fix: release command
miguelpeixe Jan 23, 2026
42fa51a
chore: temporarily disable pr comments (prevent spam)
miguelpeixe Jan 23, 2026
55eade1
fix: set repo env var
miguelpeixe Jan 26, 2026
43c99ca
fix: disable release labels
miguelpeixe Jan 26, 2026
a52324c
fix: github repo env var
miguelpeixe Jan 26, 2026
1b654fa
fix: move repo var to parent repo
miguelpeixe Jan 26, 2026
15be7d5
fix: rebase before push
miguelpeixe Jan 27, 2026
7f5f389
fix: install mysql client
miguelpeixe Jan 27, 2026
ab7fabc
fix: add php setup
miguelpeixe Jan 27, 2026
8399c70
fix: add php setup
miguelpeixe Jan 27, 2026
6039e80
fix: move secret env
miguelpeixe Jan 27, 2026
9dd364f
fix: fetch all history
miguelpeixe Jan 27, 2026
3377358
fix: update permissions
miguelpeixe Jan 27, 2026
15442fd
fix: update permissions
miguelpeixe Jan 27, 2026
f69ff62
fix: add GITHUB_REPOSITORY environment variable
miguelpeixe Jan 27, 2026
7ee3840
Update .github/workflows/reusable-i18n.yml
miguelpeixe Jan 27, 2026
1a22095
Update .github/workflows/release.yml
miguelpeixe Jan 27, 2026
1947852
fix: add GIT_COMMITTER_NAME and GITHUB_COMMITTER_EMAIL to workflow
miguelpeixe Jan 27, 2026
790f10c
Merge branch 'refactor/deprecate-circle-ci' of https://github.com/Aut…
miguelpeixe Jan 27, 2026
083bc1f
refactor: replace GITHUB_REPOSITORY secret with github.repository in …
miguelpeixe Jan 27, 2026
2bde1b7
chore: set fetch-depth to 0 in reusable-post-release workflow for com…
miguelpeixe Jan 27, 2026
b2da515
fix: remove XDEBUG_MODE from test command in reusable-test-php workflow
miguelpeixe Jan 27, 2026
722c02a
chore: remove GITHUB_TOKEN requirement from reusable-generate-docs wo…
miguelpeixe Jan 27, 2026
46dae4a
chore: add write permissions for contents in reusable-generate-docs w…
miguelpeixe Jan 27, 2026
055fd86
fix: restore conditional posting of GitHub PR comments for specific b…
miguelpeixe Jan 27, 2026
b9ca882
fix: remove CircleCI references from release-wporg.sh
rbcorrales Jan 27, 2026
27edf10
refactor: reusable WP.org release workflow (#226)
rbcorrales Jan 30, 2026
adb73f9
chore: restore circleci config
miguelpeixe Jan 30, 2026
a61eef4
chore: restore scripts
miguelpeixe Jan 30, 2026
6afc6e1
feat: add script path resolution for GitHub Actions
miguelpeixe Jan 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
command: npm install --legacy-peer-deps
- run:
name: release
command: npm run semantic-release || true
command: npm run semantic-release || true
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
branches:
- trunk
- alpha
- 'hotfix/**'
- 'epic/**'

jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Verify Node version
run: node --version

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Release
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm run semantic-release
50 changes: 50 additions & 0 deletions .github/workflows/reusable-build-distributable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build Distributable

on:
workflow_call:
inputs:
archive-name:
description: 'Name of the ZIP archive distributable'
required: true
type: string

jobs:
build-distributable:
name: Build distributable files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Verify Node version
run: node --version

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
tools: composer

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Install rsync
run: sudo apt-get update && sudo apt-get install -y rsync

- name: Install PHP packages
run: composer install --no-dev --no-scripts

- name: Build plugin files
run: npm run build && npm run release:archive

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.archive-name }}
path: release/${{ inputs.archive-name }}.zip
24 changes: 24 additions & 0 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on:
workflow_call:

jobs:
build:
name: Install node dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Verify Node version
run: node --version

- name: Install dependencies
run: npm ci --legacy-peer-deps
27 changes: 27 additions & 0 deletions .github/workflows/reusable-check-typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check TypeScript

on:
workflow_call:

jobs:
check-typescript:
name: Validate TypeScript
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Verify Node version
run: node --version

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Validate TypeScript
run: npm run typescript:check
39 changes: 39 additions & 0 deletions .github/workflows/reusable-generate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Generate Docs

permissions:
contents: write

on:
workflow_call:

jobs:
generate-docs:
name: Generate documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y graphviz plantuml

- name: Download PHPDocumentor
run: |
curl -L -o ./phpdocumentor https://phpdoc.org/phpDocumentor.phar
chmod +x ./phpdocumentor

- name: Generate documentation
run: ./phpdocumentor run -d . -t ./docs

- name: Switch to docs branch, commit, and push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME || 'github-actions[bot]' }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL || 'github-actions[bot]@users.noreply.github.com' }}
run: |
git config user.name "$GIT_COMMITTER_NAME"
git config user.email "$GIT_COMMITTER_EMAIL"
git checkout -b docs
git add -f docs
git commit -m "Update the docs"
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" docs --force
136 changes: 136 additions & 0 deletions .github/workflows/reusable-i18n.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: i18n

on:
workflow_call:

permissions:
contents: write

jobs:
i18n:
name: Create translation files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Check if commit author is bot
id: check-bot
env:
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL || 'github-actions[bot]@users.noreply.github.com' }}
run: |
COMMIT_AUTHOR=$(git log -1 --pretty=format:'%ae')
if [ "$COMMIT_AUTHOR" = "$GIT_COMMITTER_EMAIL" ]; then
echo "Commit was made by bot ($(git rev-parse --short HEAD)), skipping translation update"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi

- name: Install dependencies
if: steps.check-bot.outputs.skip != 'true'
run: npm ci --legacy-peer-deps

- name: Configure PHP for deep nesting
if: steps.check-bot.outputs.skip != 'true'
run: |
# Increase xdebug max_nesting_level to handle deeply nested JS files
echo "xdebug.max_nesting_level=512" | sudo tee -a $(php -i | grep "Scan this dir for additional .ini files" | cut -d' ' -f9)/99-custom.ini

- name: Install WP CLI
if: steps.check-bot.outputs.skip != 'true'
run: |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

- name: Build plugin files
if: steps.check-bot.outputs.skip != 'true'
run: npm run build || true

- name: Create POT translation files
if: steps.check-bot.outputs.skip != 'true'
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
# Theme is excluded, more in https://github.com/Automattic/newspack-theme/pull/2458
if [ "$REPO_NAME" = "newspack-theme" ]; then
cd ./newspack-theme
wp i18n make-pot . languages/${REPO_NAME}.pot --exclude='src' --domain=${REPO_NAME}
cd -
else
wp i18n make-pot . languages/${REPO_NAME}.pot --domain=${REPO_NAME}
fi

- name: Create JSON translation files
if: steps.check-bot.outputs.skip != 'true'
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
if [ "$REPO_NAME" = "newspack-theme" ]; then
cd ./newspack-theme
fi

sudo apt-get update && sudo apt-get install -y gettext

cd languages

# Create PO files from POT if they don't exist
if [ ! -f "${REPO_NAME}-en_US.po" ]; then
echo "Creating ${REPO_NAME}-en_US.po from POT file"
wp i18n update-po ${REPO_NAME}.pot .
else
echo "${REPO_NAME}-en_US.po file already exists, skipping creation"
fi

for po in *.po; do
if [ -f "$po" ]; then
echo "Processing file $po …"
# Update translations according to the new POT file
msgmerge $po $REPO_NAME.pot -o $po.out
mv $po.out $po
msgfmt $po -o $(basename $po .po).mo
# no-purge since we need the JS translations for the next run
wp i18n make-json --no-purge $po .
fi
done

- name: Commit translation files
if: steps.check-bot.outputs.skip != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_NAME: ${{ github.event.repository.name }}
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME || 'github-actions[bot]' }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL || 'github-actions[bot]@users.noreply.github.com' }}
run: |
if [ "$REPO_NAME" = "newspack-theme" ]; then
cd ./newspack-theme
fi
if [ -d "languages" ]; then
LINES_CHANGED=$(git diff --numstat languages/ | awk '{sum += $1 + $2} END {print sum}')
# If no existing files were changed, check for new files
if [ -z "$LINES_CHANGED" ] || [ "$LINES_CHANGED" -eq 0 ]; then
LINES_CHANGED=$(git ls-files --others --exclude-standard languages/ | xargs wc -l 2>/dev/null | tail -1 | awk '{print $1}')
fi
else
LINES_CHANGED=0
fi
LINES_CHANGED=${LINES_CHANGED:-0}
echo "Lines changed in languages/: $LINES_CHANGED"
if [ "$LINES_CHANGED" -gt 3 ]; then
git config user.email "$GIT_COMMITTER_EMAIL"
git config user.name "$GIT_COMMITTER_NAME"
git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/${{ github.repository }}.git
git add languages/
git commit -m "chore: update translation files [skip ci]"
git pull --rebase origin ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
fi
28 changes: 28 additions & 0 deletions .github/workflows/reusable-lint-js-scss.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint JS & SCSS

on:
workflow_call:

jobs:
lint-js-scss:
name: Lint JS & SCSS files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Verify Node version
run: node --version

- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Run Linter
# Temporarily skip linting SCSS due to stylelint config updates. Remove :js when ready to re-enable linting of SCSS.
run: npm run lint:js
30 changes: 30 additions & 0 deletions .github/workflows/reusable-lint-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Lint PHP

on:
workflow_call:
inputs:
php-version:
description: 'PHP version to use'
required: false
type: string
default: '8.3'

jobs:
lint-php:
name: Lint PHP files
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
tools: composer

- name: Install Composer dependencies
run: composer install

- name: Lint PHP files
run: ./vendor/bin/phpcs
Loading