Skip to content
Merged
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
19 changes: 7 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,13 @@ All notable changes to `@rtcamp/wp-shared-workflows` are documented in this file

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Unreleased

### Changed

- Every reusable workflow takes its runner from a new `runs-on` input (JSON: a label or a list of labels), defaulting to GitHub-hosted `"ubuntu-latest"`, and `wp-ci.yml` and `wp-cd.yml` forward it to every workflow they call. Hard-coding `[self-hosted]` left public callers (and this public repository's own CI) queued with no runner, since a reusable workflow's jobs run in the calling repository. rtCamp's private repositories pass `'["self-hosted"]'`, as the org runner policy requires. `ci-self-check.yml` runs on `ubuntu-latest`, and `bin/check-workflows.sh` now requires reusable workflows to use and forward the input instead of checking a label allow-list.

### Fixed

- `ci-lint-css.yml` no longer passes `package.json` and `package-lock.json` to Stylelint. `ci-detect-changes` lists them in `css-files` so that a dependency change re-runs the job, and Stylelint failed on them with `CssSyntaxError`. When `changed-files` holds anything other than stylesheets, or is empty, the job now runs `lint-command` over the whole project.
- `ci-lint-php.yml` no longer passes deleted files or non-PHP files to PHPCS. `ci-detect-changes` lists `composer.json`, `composer.lock` and the PHPStan config in `php-files`, and a change that deletes PHP files lists them too, so PHPCS failed with `does not exist` or `Start tag expected`. Changed PHP files that still exist are linted file by file; if the list holds anything else, PHPCS lints the whole project.

## v1.0.0 - 2026-09-30
## v1.0.0 - 2026-10-01

First tagged release. Consumers pin `@v1`.

### Changed

- Every reusable workflow takes its runner from a new `runs-on` input (JSON: a label or a list of labels), defaulting to GitHub-hosted `"ubuntu-latest"`, and `wp-ci.yml` and `wp-cd.yml` forward it to every workflow they call. Hard-coding `[self-hosted]` left public callers (and this public repository's own CI) queued with no runner, since a reusable workflow's jobs run in the calling repository. rtCamp's private repositories pass `'["self-hosted"]'`, as the org runner policy requires. `ci-self-check.yml` runs on `ubuntu-latest`, and `bin/check-workflows.sh` now requires reusable workflows to use and forward the input instead of checking a label allow-list.
- Caller values no longer reach a `run:` body through `${{ }}` interpolation — a convention `AGENTS.md` already documented but sixteen steps across eight workflows broke. Value inputs (`composer-flags`, `phpstan-level`) now travel through step `env:` and become argv, so shell metacharacters in them stay literal instead of executing. Command inputs (`build-command`, `test-command`, `phpcs-command`, `phpstan-command`, `lint-command`, and `cd-built-branch.yml`'s per-target equivalents) also travel through `env:` and are run as `bash -eo pipefail -c "$COMMAND"`: executing them is the contract, but routing them through the environment stops render-time splicing, where a newline in the value injects extra lines into the generated script. `-eo pipefail` is not optional — a bare `bash -c` does not inherit `set -e`, so a failing command would exit 0 and pass a job green. `bin/check-workflows.sh` now fails on any `${{ inputs. }}`/`${{ matrix. }}` inside a `run:` body, so the convention is verified rather than merely documented.
- `cd-github-release.yml` packages the release asset instead of attaching the artifact's top-level entries directly. `gh release create` only accepts files, but `download-artifact` unpacks a directory artifact, so any plugin with a subdirectory — including the shape `examples/cd-github-release.yml` produces — failed at the upload. A directory artifact is now re-rooted under `<slug>/` and zipped to a single `<slug>.zip` that installs through wp-admin; an artifact that is already a single archive is attached untouched, so a pre-zipped `artifact-path` keeps working. The two cases are told apart by archive extension rather than file count, so a single-file plugin still gets packaged. Adds an optional `slug` input (defaults to `artifact-name`).
- `ci-test-js.yml`'s `enable-cache` now caches something. Jest has no `JEST_CACHE_DIRECTORY` environment variable, so the previous wiring cached an always-empty directory, and the fixed `jest-<os>` key was written once and never updated again. The cache directory is now passed as a real `--cacheDirectory` argument and the key includes the `working-dir`-scoped lockfile hash with a `restore-keys` fallback. A custom `test-command` must forward its arguments for the flag to land; the default does.
Expand Down Expand Up @@ -59,3 +49,8 @@ First tagged release. Consumers pin `@v1`.
- `ci-lint-php.yml`: reusable PHPCS workflow with `cs2pr` annotations and an optional PHPStan pass (`enable-phpstan`, default `false`). `changed-files` scopes PHPCS to the listed files; PHPStan always runs whole-project because it analyses cross-file dependencies. Default `composer-flags` keep `--no-scripts` for supply-chain hygiene. Inputs: `php-version`, `enable-phpstan`, `phpcs-command`, `changed-files`, `phpstan-command`, `phpstan-level`, `composer-flags`, `validate-composer`, `working-dir`.
- `wp-cd.yml`: CD orchestrator that fans out to `cd-github-release.yml`, `cd-wp-org.yml` and `cd-s3.yml` from one comma-separated `deploy-target` input (`github`, `wporg`, `s3`). A `validate-inputs` job fails the run before any deploy starts on an empty `tag` or `artifact-name`, an empty or whitespace-containing target list, an empty entry, an unknown target, or a listed target missing its required inputs or secrets (`wporg` needs `slug` + `WP_ORG_USERNAME`/`WP_ORG_PASSWORD`, `s3` needs `bucket` + `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`; secrets are presence-checked as booleans, so no secret material reaches the environment). Targets match comma-bounded, like `wp-ci.yml`'s `skip`, and run in parallel. Every leaf input passes through under its own name and default; `slug` also sets the Release zip's root directory, and `working-dir` reaches both leaves that read the source tree. There is no `permissions` block, so the calling job must grant `contents: write` on every call — GitHub checks nested jobs' permissions against the caller's grant before it evaluates `if:`, even when `github` is not listed. All four secrets are optional; map only the ones the listed targets need. Inputs: `tag`, `artifact-name`, `deploy-target`, `slug`, `working-dir`, `changelog-path`, `draft`, `prerelease`, `assets-path`, `dry-run`, `bucket`, `prefix`, `cloudfront-distribution-id`, `region`.
- `wp-ci.yml`: CI orchestrator that routes to the individual CI workflows from one `project-type` input (`plugin` \| `theme` \| `package`). `detect-changes` runs first as a never-skippable backbone; every other job is gated on its per-bucket change counts and fed the matching `*-files` list, so a job runs only when its file type changed and its preset includes it. `skip` drops jobs by id with comma-exact matching (`skip: build` does not also drop `build-artifact`). `test-php` fans out over `php-versions` × `wp-versions` minus `test-php-exclude` cells; `use-wp-env` (default `true`) boots `@wordpress/env` per cell, pinning `WP_ENV_PHP_VERSION`/`WP_ENV_CORE`, while `false` runs standalone PHPUnit for a pure Composer library and leaves the `wp` dimension inert. `enable-phpstan` (default `false`) opts `lint-php` into a PHPStan pass. A `validate-inputs` job fails the run fast on an invalid `project-type` or a non-array matrix input, resolves the job preset from a single table, and derives a per-unit `artifact-name` (two units uploading the same name in one run is a `409 Conflict`) and a `build-artifact-slug` defaulting to `basename(working-dir)`. The `build-artifact` install test is opt-in via `build-artifact-path`; `artifact-gate` is opt-in via `gated-paths`, since failing a PR for committed build output is only correct where CI produces it. A `working-dir` input targets one unit in a monorepo and is forwarded to every child job, so `project-type` describes the unit at `working-dir` rather than the repository — a repo with a theme and two plugins calls this workflow three times, or matrixes over the units in one caller job. Concurrency includes `project-type` and `working-dir` so sibling calls do not cancel each other. Inputs: `project-type`, `working-dir`, `skip`, `enable-phpstan`, `run-a11y`, `use-wp-env`, `php-versions`, `wp-versions`, `test-php-exclude`, `build-artifact-path`, `build-artifact-slug`, `ignore-paths`, `base-ref`, `gated-paths`, `wp-tooling-ref`. Code coverage reporting is not yet included (v1.x follow-up).

### Fixed

- `ci-lint-css.yml` no longer passes `package.json` and `package-lock.json` to Stylelint. `ci-detect-changes` lists them in `css-files` so that a dependency change re-runs the job, and Stylelint failed on them with `CssSyntaxError`. When `changed-files` holds anything other than stylesheets, or is empty, the job now runs `lint-command` over the whole project.
- `ci-lint-php.yml` no longer passes deleted files or non-PHP files to PHPCS. `ci-detect-changes` lists `composer.json`, `composer.lock` and the PHPStan config in `php-files`, and a change that deletes PHP files lists them too, so PHPCS failed with `does not exist` or `Start tag expected`. Changed PHP files that still exist are linted file by file; if the list holds anything else, PHPCS lints the whole project.