# Trigger when you push a git tag matching the pattern `v*` (e.g., `v1.0.0`, `v2.1.0`)
on:
push:
tags:
- 'v*'
jobs:
main:
uses: chrono-meter/actions-wordpress/.github/workflows/ci-plugin.yaml@main
permissions:
contents: write
actions: writeSee details for with options.
{
"scripts": {
"ci:build": "npm ci --force && YOUR BUILD COMMANDS...",
"ci:test": "npm ci --force && YOUR TEST COMMANDS..."
}
}Oh, sorry...
This workflow automates the CI/CD pipeline for WordPress plugin releases:
- Executes
npm run ci:buildfor building the plugin- You can skip this step by
enable-build: falseinwith
- You can skip this step by
- Creates ZIP archive file
dist.zip - Uses
@chrono-meter/wp-zip-package(and.distignorewhen present) to exclude unnecessary files.
- Executes
npm run ci:testfor running tests - Full WordPress instance will be created with Apache (port
80and443, self certified https) and MySQL. - Installs the built ZIP through WP-CLI before tests run.
- Runs as matrix across
php-versions,wp-versions, andwp-languages. - You can use
playwrightfor E2E testing. - You can skip this job by
enable-tests: falseinwith
During npm run ci:test, the following environment variables are available:
WP_ABSPATH: Absolute path to the WordPress installation.WP_BASE_URL: Base URL of WordPress (must end with/).WP_USERNAME: WordPress admin username.WP_PASSWORD: WordPress admin password.CI: Alwaystrue.
- Renames ZIP archive file as
REPOSITORY-VERSION.zip.- Example: repository
my-pluginand tagv1.2.3->my-plugin-1.2.3.zip
- Example: repository
- Creates GitHub Release for the current tag and uploads the ZIP as a release asset.
- Release not created:
- Confirm workflow was triggered by a tag like
v1.2.3. - Confirm
permissions.
- Confirm workflow was triggered by a tag like
- Test cannot log in:
- Ensure
WP_BASE_URLhas trailing/and matches your test assumptions. - Verify test code uses
WP_USERNAMEandWP_PASSWORD.
- Ensure
- Playwright report missing:
- Report uploads only when
playwright-report/exists.
- Report uploads only when