Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions node-packages/wp-tooling/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

- `detect-changes` buckets the remaining tool config files that change what a job checks, so a pull request that only touches one no longer skips that job. `php` now claims `phpcs*.xml` and `.phpcs*.xml` (with or without `.dist`, so `phpcs.i18n.xml.dist` and `phpcs-custom.xml` count), `phpunit*.xml(.dist)`, `.wp-env.json` and its `.wp-env.<name>.json` variants, and `.distignore`. `js` also claims `jest.config.json` and `tsconfig*.json` / `jsconfig*.json` (any name, such as `tsconfig-base.json` or `tsconfig.app.build.json`), and `css` also claims `postcss.config.*`. `.nvmrc` counts under `css`, `js` and `php` (test-php runs `wp-env` on that Node version), `.browserslistrc` under `css` and `js`, and `block.json` under `js` and `php`. rtCamp/wp-shared-workflows lints the whole project when a bucket's list holds anything but source files, so a ruleset change is checked against every file.
- The `wp-tooling` binary waits for stdout and stderr to drain before it exits. Writes to a pipe are asynchronous on POSIX, so a report longer than the pipe buffer piped into a reader that was not ready yet (`wp-tooling list --json | jq`) arrived cut off at 64 KiB, as invalid JSON, and a long error message on stderr was cut the same way. Exit codes are unchanged, and a closed pipe on either stream (`2>&1 | head`) exits straight away with the command's own code instead of 1.
- The CI scaffolds call rtCamp/wp-shared-workflows at `@v1`. `ci/lint-css`, `ci/lint-js` and `ci/lint-php` defaulted to the `v1.0.0/task/ci-lint-workflows` branch, which no longer exists, so a workflow scaffolded with the defaults failed before any job ran. `ci/test-measure` defaulted to the stale `release/v1.0.0` branch. The lint templates and the `wp-tooling list` descriptions drop their outdated "EXPERIMENTAL" wording.
- `ci/cd-wporg` works. It passed inputs and secrets `cd-wp-org.yml` never had (`plugin-slug`, `svn-username`, `svn-password`) and deployed an artifact nothing built, so it failed before any job ran. It now builds with `ci-build.yml`, packages with `npx @rtcamp/wp-tooling release:zip` (honouring `.distignore`; the scoped name, so npx never fetches an unrelated `wp-tooling` package from the registry), and deploys with `cd-wp-org.yml`'s `slug`, `tag`, `artifact-name` and `WP_ORG_USERNAME`/`WP_ORG_PASSWORD`. New inputs: `wsw_ref`, `build_command`, `assets_path`.
- `node_version` in the `ci/build`, `ci/lint-css`, `ci/lint-js`, `ci/test-a11y`, `ci/test-js` and `ci/test-php` scaffolds defaults to empty, which leaves `node-version` out of the generated workflow, so the shared workflow uses the project's `.nvmrc`. The old default of `22` overrode `.nvmrc`. Passing `--node_version` still pins a version.
- `ci/test-measure`'s default WordPress versions include 7.1.

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"slug": "artifact-gate",
"category": "ci",
"name": "CI: Block committed build artifacts",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-build-artifact-gate.yml. Fails the PR if build outputs (assets/build/ by default) are committed. Stable (merged into release/v1.0.0).",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-build-artifact-gate.yml. Fails the PR if build outputs (assets/build/ by default) are committed. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
Expand Down
6 changes: 3 additions & 3 deletions node-packages/wp-tooling/scaffolds/ci/build/scaffold.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"slug": "build",
"category": "ci",
"name": "CI: production build",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-build.yml. Produces a production build (npm and/or composer) and optionally uploads the result as an artifact for downstream CD jobs. Stable (merged into release/v1.0.0).",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-build.yml. Produces a production build (npm and/or composer) and optionally uploads the result as an artifact for downstream CD jobs. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
Expand All @@ -12,8 +12,8 @@
},
{
"key": "node_version",
"description": "Node.js version for the build.",
"default": "22"
"description": "Node.js version. Leave empty to use the project's .nvmrc, which the shared workflow reads.",
"default": ""
},
{
"key": "php_version",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-build.yml@{{wsw_ref}}
with:
install-node-deps: true
install-composer-deps: {{install_composer_deps}}
node-version: "{{node_version}}"
install-composer-deps: {{install_composer_deps}}{{#node_version}}
node-version: "{{node_version}}"{{/node_version}}
php-version: "{{php_version}}"
upload-artifact: {{upload_artifact}}
17 changes: 16 additions & 1 deletion node-packages/wp-tooling/scaffolds/ci/cd-wporg/scaffold.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@
"slug": "cd-wporg",
"category": "ci",
"name": "WordPress.org deploy",
"description": "Deploys built plugin asset to WordPress.org SVN on each GitHub release. Wraps the wp-shared-workflows reusable.",
"description": "Builds and packages the plugin, then deploys it to WordPress.org SVN on each published GitHub release, with the wp-shared-workflows ci-build.yml and cd-wp-org.yml.",
"source": "template",
"inputs": [
{
"key": "plugin_slug",
"description": "WordPress.org plugin slug (must match the slug registered with .org).",
"required": true
},
{
"key": "wsw_ref",
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Pin a major tag such as `v1`, never a branch: branches move or get deleted.",
"default": "v1"
},
{
"key": "build_command",
"description": "Builds the plugin and leaves exactly the files to deploy in dist/plugin (readme.txt at its root). The default builds, packages with `wp-tooling release:zip` (which honours .distignore) and unpacks the zip; python3 is used because self-hosted runners have no unzip.",
"default": "npm run build:prod && npx @rtcamp/wp-tooling release:zip && python3 -m zipfile -e dist/*.zip dist/package && mv dist/package/*/ dist/plugin"
},
{
"key": "assets_path",
"description": "Directory mapped to SVN /assets/ (banners, icons, screenshots). Skipped if it does not exist.",
"default": ".wordpress-org"
}
],
"files": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
name: Deploy to WordPress.org

# Scaffolded by @rtcamp/wp-tooling.
# Builds and packages the plugin, then deploys it to WordPress.org SVN on each
# published GitHub release, with the reusable ci-build.yml and cd-wp-org.yml from
# rtCamp/wp-shared-workflows.
#
# The release tag (a leading v is stripped) must match readme.txt's Stable tag.
# Needs the WPORG_USERNAME and WPORG_PASSWORD repository secrets.

on:
release:
types: [published]

permissions:
contents: read

jobs:
build:
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-build.yml@{{wsw_ref}}
with:
install-composer-deps: true
build-command: '{{build_command}}'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with --build_command="npm run build && cp 'readme.txt' dist/plugin/" the rendered cd-wporg.yml doesn't parse (actionlint: could not parse as YAML: did not find expected key). The default command renders fine because it has no '.

A block scalar avoids escaping altogether, since YAML takes the line as written, so ', " and # are all safe. I checked that the default and a command containing all three render valid YAML with the exact command.

Suggested change
build-command: '{{build_command}}'
build-command: >-
{{build_command}}

upload-artifact: true
artifact-name: wporg-package
artifact-path: dist/plugin

deploy:
uses: rtCamp/wp-shared-workflows/.github/workflows/cd-wp-org.yml@v1.0.0
needs: build
uses: rtCamp/wp-shared-workflows/.github/workflows/cd-wp-org.yml@{{wsw_ref}}
with:
plugin-slug: {{plugin_slug}}
slug: {{plugin_slug}}
tag: ${{ github.event.release.tag_name }}
artifact-name: wporg-package
assets-path: {{assets_path}}
secrets:
svn-username: ${{ secrets.WPORG_USERNAME }}
svn-password: ${{ secrets.WPORG_PASSWORD }}
WP_ORG_USERNAME: ${{ secrets.WPORG_USERNAME }}
WP_ORG_PASSWORD: ${{ secrets.WPORG_PASSWORD }}
10 changes: 5 additions & 5 deletions node-packages/wp-tooling/scaffolds/ci/lint-css/scaffold.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"slug": "lint-css",
"category": "ci",
"name": "CI: Lint CSS (Stylelint)",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-lint-css.yml. Runs Stylelint over changed files in a PR, or the whole project on push. EXPERIMENTAL: the upstream workflow is currently in rtCamp/wp-shared-workflows PR #2 and has not yet shipped on `v1`.",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-lint-css.yml. Runs Stylelint over changed files in a PR, or the whole project on push. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
"key": "wsw_ref",
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Workflow is in PR #2 at the time of writing; pin to `v1.0.0/task/ci-lint-workflows` or a commit SHA until the PR is merged.",
"default": "v1.0.0/task/ci-lint-workflows"
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Pin a major tag such as `v1`, never a branch: branches move or get deleted.",
"default": "v1"
},
{
"key": "node_version",
"description": "Node.js version.",
"default": "22"
"description": "Node.js version. Leave empty to use the project's .nvmrc, which the shared workflow reads.",
"default": ""
}
],
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: CI / Lint (CSS)
# Scaffolded by @rtcamp/wp-tooling.
# Calls the reusable ci-lint-css.yml from rtCamp/wp-shared-workflows.
#
# EXPERIMENTAL: this reusable workflow is currently in rtCamp/wp-shared-workflows
# PR #2 and has not yet shipped on the `v1` tag. The `uses:` line below pins to
# the PR branch; switch to `@v1` (or a SHA) once the PR is merged.
#
# Source: https://github.com/rtCamp/wp-shared-workflows/blob/{{wsw_ref}}/.github/workflows/ci-lint-css.yml

on:
Expand All @@ -22,6 +18,6 @@ permissions:

jobs:
lint-css:
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-lint-css.yml@{{wsw_ref}}
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-lint-css.yml@{{wsw_ref}}{{#node_version}}
with:
node-version: "{{node_version}}"
node-version: "{{node_version}}"{{/node_version}}
10 changes: 5 additions & 5 deletions node-packages/wp-tooling/scaffolds/ci/lint-js/scaffold.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"slug": "lint-js",
"category": "ci",
"name": "CI: Lint JS (ESLint)",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-lint-js.yml. Runs ESLint over changed files in a PR, or the whole project on push. Optionally validates package.json shape first. EXPERIMENTAL: the upstream workflow is currently in rtCamp/wp-shared-workflows PR #2 and has not yet shipped on `v1`.",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-lint-js.yml. Runs ESLint over changed files in a PR, or the whole project on push. Optionally validates package.json shape first. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
"key": "wsw_ref",
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Workflow is in PR #2 at the time of writing; pin to `v1.0.0/task/ci-lint-workflows` or a commit SHA until the PR is merged.",
"default": "v1.0.0/task/ci-lint-workflows"
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Pin a major tag such as `v1`, never a branch: branches move or get deleted.",
"default": "v1"
},
{
"key": "node_version",
"description": "Node.js version.",
"default": "22"
"description": "Node.js version. Leave empty to use the project's .nvmrc, which the shared workflow reads.",
"default": ""
},
{
"key": "validate_package_json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: CI / Lint (JS)
# Scaffolded by @rtcamp/wp-tooling.
# Calls the reusable ci-lint-js.yml from rtCamp/wp-shared-workflows.
#
# EXPERIMENTAL: this reusable workflow is currently in rtCamp/wp-shared-workflows
# PR #2 and has not yet shipped on the `v1` tag. The `uses:` line below pins to
# the PR branch; switch to `@v1` (or a SHA) once the PR is merged.
#
# Source: https://github.com/rtCamp/wp-shared-workflows/blob/{{wsw_ref}}/.github/workflows/ci-lint-js.yml

on:
Expand All @@ -23,6 +19,6 @@ permissions:
jobs:
lint-js:
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-lint-js.yml@{{wsw_ref}}
with:
node-version: "{{node_version}}"
with:{{#node_version}}
node-version: "{{node_version}}"{{/node_version}}
validate-package-json: {{validate_package_json}}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"slug": "lint-php",
"category": "ci",
"name": "CI: Lint PHP (PHPCS + optional PHPStan)",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-lint-php.yml. Runs PHPCS (and optionally PHPStan) over changed files in a PR, or the whole project on push. EXPERIMENTAL: the upstream workflow is currently in rtCamp/wp-shared-workflows PR #2 and has not yet shipped on `v1`. Pin `wsw_ref` to the PR branch or a SHA until the PR merges.",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-lint-php.yml. Runs PHPCS (and optionally PHPStan) over changed files in a PR, or the whole project on push. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
"key": "wsw_ref",
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Workflow is in PR #2 at the time of writing; pin to `v1.0.0/task/ci-lint-workflows` or a commit SHA until the PR is merged into v1.",
"default": "v1.0.0/task/ci-lint-workflows"
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Pin a major tag such as `v1`, never a branch: branches move or get deleted.",
"default": "v1"
},
{
"key": "php_version",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ name: CI / Lint (PHP)
# Scaffolded by @rtcamp/wp-tooling.
# Calls the reusable ci-lint-php.yml from rtCamp/wp-shared-workflows.
#
# EXPERIMENTAL: this reusable workflow is currently in rtCamp/wp-shared-workflows
# PR #2 and has not yet shipped on the `v1` tag. The `uses:` line below pins to
# the PR branch; switch to `@v1` (or a SHA) once the PR is merged.
#
# Source: https://github.com/rtCamp/wp-shared-workflows/blob/{{wsw_ref}}/.github/workflows/ci-lint-php.yml

on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"slug": "test-a11y",
"category": "ci",
"name": "CI: Accessibility (pa11y)",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-test-a11y.yml. Runs pa11y-ci WCAG2AA scans against a wp-env-booted site. Stable (merged into release/v1.0.0).",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-test-a11y.yml. Runs pa11y-ci WCAG2AA scans against a wp-env-booted site. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
Expand All @@ -12,8 +12,8 @@
},
{
"key": "node_version",
"description": "Node.js version.",
"default": "22"
"description": "Node.js version. Leave empty to use the project's .nvmrc, which the shared workflow reads.",
"default": ""
}
],
"files": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ permissions:

jobs:
test-a11y:
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-test-a11y.yml@{{wsw_ref}}
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-test-a11y.yml@{{wsw_ref}}{{#node_version}}
with:
node-version: "{{node_version}}"
node-version: "{{node_version}}"{{/node_version}}
Comment thread
aryanjasala marked this conversation as resolved.
Resolved
6 changes: 3 additions & 3 deletions node-packages/wp-tooling/scaffolds/ci/test-js/scaffold.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"slug": "test-js",
"category": "ci",
"name": "CI: Jest",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-test-js.yml. Runs Jest with optional cache. Stable (merged into release/v1.0.0).",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-test-js.yml. Runs Jest with optional cache. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
Expand All @@ -12,8 +12,8 @@
},
{
"key": "node_version",
"description": "Node.js version.",
"default": "22"
"description": "Node.js version. Leave empty to use the project's .nvmrc, which the shared workflow reads.",
"default": ""
},
{
"key": "enable_cache",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ permissions:
jobs:
test-js:
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-test-js.yml@{{wsw_ref}}
with:
node-version: "{{node_version}}"
with:{{#node_version}}
node-version: "{{node_version}}"{{/node_version}}
enable-cache: {{enable_cache}}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"inputs": [
{
"key": "wsw_ref",
"description": "Git ref of rtCamp/wp-shared-workflows to pin (tag, branch, or SHA).",
"default": "release/v1.0.0"
"description": "Tag or ref of rtCamp/wp-shared-workflows to call. Pin a major tag such as `v1`, never a branch: branches move or get deleted.",
"default": "v1"
},
{
"key": "project_type",
Expand All @@ -28,7 +28,7 @@
{
"key": "wp_versions",
"description": "JSON array of WordPress core versions for the test-php matrix, crossed with php_versions.",
"default": "[\"6.7\", \"6.8\", \"6.9\", \"7.0\"]"
"default": "[\"6.7\", \"6.8\", \"6.9\", \"7.0\", \"7.1\"]"
},
{
"key": "test_php_exclude",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"slug": "test-php",
"category": "ci",
"name": "CI: PHPUnit",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-test-php.yml. Runs PHPUnit with optional @wordpress/env for full integration tests. Stable (merged into release/v1.0.0).",
"description": "GitHub Actions workflow that calls rtCamp/wp-shared-workflows ci-test-php.yml. Runs PHPUnit with optional @wordpress/env for full integration tests. Calls `@v1` by default.",
"source": "template",
"inputs": [
{
Expand All @@ -17,8 +17,8 @@
},
{
"key": "node_version",
"description": "Node.js version (used only when use-wp-env is true).",
"default": "22"
"description": "Node.js version. Leave empty to use the project's .nvmrc, which the shared workflow reads.",
"default": ""
},
{
"key": "use_wp_env",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:
test-php:
uses: rtCamp/wp-shared-workflows/.github/workflows/ci-test-php.yml@{{wsw_ref}}
with:
php-version: "{{php_version}}"
node-version: "{{node_version}}"
php-version: "{{php_version}}"{{#node_version}}
node-version: "{{node_version}}"{{/node_version}}
use-wp-env: {{use_wp_env}}
Loading