diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 186676fa..9ddf86d9 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,6 +7,9 @@ updates: time: '00:00' timezone: 'Asia/Calcutta' open-pull-requests-limit: 10 + commit-message: + prefix: build + include: scope labels: - GHA - Dependencies @@ -18,6 +21,9 @@ updates: time: '00:00' timezone: 'Asia/Calcutta' open-pull-requests-limit: 10 + commit-message: + prefix: build + include: scope labels: - NPM - Dependencies @@ -38,6 +44,9 @@ updates: time: '00:00' timezone: 'Asia/Calcutta' open-pull-requests-limit: 10 + commit-message: + prefix: build + include: scope labels: - Composer - Dependencies diff --git a/.github/release-starter/config.json b/.github/release-starter/config.json new file mode 100644 index 00000000..0ef2d523 --- /dev/null +++ b/.github/release-starter/config.json @@ -0,0 +1,69 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "node", + "changelog-path": "CHANGELOG.md", + "include-v-in-tag": true, + "include-component-in-tag": false, + "changelog-sections": [ + { + "type": "feat", + "section": "Added" + }, + { + "type": "fix", + "section": "Fixed" + }, + { + "type": "perf", + "section": "Changed" + }, + { + "type": "revert", + "section": "Changed" + }, + { + "type": "build", + "section": "Changed" + }, + { + "type": "docs", + "section": "Documentation", + "hidden": true + }, + { + "type": "style", + "section": "Styles", + "hidden": true + }, + { + "type": "chore", + "section": "Miscellaneous", + "hidden": true + }, + { + "type": "refactor", + "section": "Code Refactoring", + "hidden": true + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "extra-files": [ + { + "type": "generic", + "path": "style.css" + } + ] + } + } +} diff --git a/.github/release-starter/manifest.json b/.github/release-starter/manifest.json new file mode 100644 index 00000000..895bf0e3 --- /dev/null +++ b/.github/release-starter/manifest.json @@ -0,0 +1,3 @@ +{ + ".": "2.0.0" +} diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index ba30c9cc..dec175cb 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -32,7 +32,7 @@ jobs: if: | contains( github.event.workflow_run.head_commit.message, 'version-update:semver-minor' ) || contains( github.event.workflow_run.head_commit.message, 'version-update:semver-patch' ) - run: gh pr merge "$PR_NUMBER" --auto --merge --delete-branch + run: gh pr merge "$PR_NUMBER" --auto --squash --delete-branch env: GH_REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} @@ -53,7 +53,7 @@ jobs: endsWith(github.event.workflow_run.head_commit.message, format('{0} {1}', 'rtBot', '<43742164+rtBot@users.noreply.github.com>')) && github.event.workflow_run.head_commit.author.name == 'rtBot' && github.event.workflow_run.head_commit.author.email == '43742164+rtBot@users.noreply.github.com' - run: gh pr merge "$PR_NUMBER" --auto --merge --delete-branch + run: gh pr merge "$PR_NUMBER" --auto --squash --delete-branch env: GH_REPO: ${{ github.repository }} PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }} diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 00000000..14f5bd9f --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,31 @@ +name: PR Title Validation + +# Pull requests are squash-merged and the PR title becomes the commit on main. release-please +# reads those subjects to pick the next version and write CHANGELOG.md, so the title has to be a +# Conventional Commit: feat -> minor, fix -> patch, a "!" after the type -> major. +# +# Not a required status check: the release pull request is opened with GITHUB_TOKEN, which +# starts no workflow runs, so this check never reports on it. + +on: + pull_request: + types: [opened, synchronize, edited, reopened, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: {} + +jobs: + run: + name: Validate PR title + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + permissions: + pull-requests: read + steps: + - name: Validate pull request title + uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1 + env: + GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/release-starter.yml b/.github/workflows/release-starter.yml new file mode 100644 index 00000000..977556b5 --- /dev/null +++ b/.github/workflows/release-starter.yml @@ -0,0 +1,42 @@ +name: Release (starter) + +# release-please reads the Conventional Commit subjects squash-merged to main and keeps one +# release pull request open that bumps the version and writes CHANGELOG.md. Merging that pull +# request tags vX.Y.Z on main and publishes the GitHub release with the changelog entry as notes. +# +# The release pull request is opened with GITHUB_TOKEN, so GitHub starts no workflow runs on it +# (no tests, no PR title check). That is why neither check is a required status check. Switching +# the token below to a GitHub App token would give the release pull request its CI runs. +# +# This file releases the starter itself, from the config and manifest in .github/release-starter/. +# Init cleanup removes all of them, so projects made from the starter don't inherit them. + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + +# Serialise runs so two merges in quick succession can't race on the release pull request. +concurrency: + group: release + cancel-in-progress: false + +jobs: + release-please: + name: Release Please + runs-on: ubuntu-latest + permissions: + contents: write + issues: write + pull-requests: write + steps: + - name: Open or update the release pull request, or publish the release + uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + with: + token: ${{ github.token }} + config-file: .github/release-starter/config.json + manifest-file: .github/release-starter/manifest.json diff --git a/CHANGELOG.md b/CHANGELOG.md index a99c2233..918cedbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + ## Unreleased ## 2.0.0 - 2026-10-01 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5758ecda..fbf9683c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ Run the relevant focused tests and lint commands in [Local development](docs/loc - [ ] The relevant focused tests and lint commands pass. - [ ] New/changed behavior is covered by tests. -- [ ] Commits follow [Conventional Commits](https://www.conventionalcommits.org/). +- [ ] Commits follow [Conventional Commits](https://www.conventionalcommits.org/), and so does the PR title: pull requests are squash-merged, and the title becomes the commit on `main`. ## License diff --git a/bin/scaffold.config.js b/bin/scaffold.config.js index bf46a053..467dff24 100644 --- a/bin/scaffold.config.js +++ b/bin/scaffold.config.js @@ -166,6 +166,11 @@ module.exports = { '.github/prompts', '.github/instructions', 'languages', + // The starter's own release workflow, config and manifest. Cleanup also runs + // on re-init and --clean, so both paths are named for the starter: a + // project's own release-please files never live there. + '.github/release-starter', + '.github/workflows/release-starter.yml', ], }, diff --git a/docs/initialization.md b/docs/initialization.md index f33050a1..e3f360e1 100644 --- a/docs/initialization.md +++ b/docs/initialization.md @@ -60,7 +60,7 @@ npm run init -- --name="Acme Blog" --version=1.0.0 --yes --remove-examples | Optional features | HMR updates `.env.local`; Tailwind adds its entry/config and declarations. | | State | `.wp-scaffold.json` records identity and feature choices; do not hand-edit it. | | Autoload | Setup regenerates Composer's autoloader. | -| Cleanup | Before the wrapper's final sync, the Copilot-specific `.github` files (`copilot-instructions.md`, `prompts/`, `instructions/`) and `languages` (including the starter POT file) are removed. Workflows, issue templates, the PR template, `dependabot.yml`, and `release.yml` stay untouched. | +| Cleanup | Before the wrapper's final sync, the Copilot-specific `.github` files (`copilot-instructions.md`, `prompts/`, `instructions/`) and `languages` (including the starter POT file) are removed, along with the starter's own release workflow, config and manifest (`.github/workflows/release-starter.yml`, `.github/release-starter/`). The other workflows, issue templates, the PR template, `dependabot.yml`, and `.github/release.yml` stay untouched. | | AI instructions | After a successful change, the wrapper runs `sync-ai`; in a standalone project with the framework installed, it refreshes the generated framework PHP instructions. It does not restore the removed prompts or theme-specific rules. | | Retained files | Theme source, `bin/`, Claude skills, documentation, and test infrastructure remain; files belonging to removed example sets do not. | diff --git a/docs/internal/maintenance.md b/docs/internal/maintenance.md index 0c392dfd..079a16c8 100644 --- a/docs/internal/maintenance.md +++ b/docs/internal/maintenance.md @@ -18,7 +18,7 @@ If an installation route or feature cannot be exercised, report the missing prer ### Cleanup checks -Check that the Copilot-specific `.github` files (`copilot-instructions.md`, `prompts/`, `instructions/`) and `languages` are removed, while workflows, issue templates, and the PR template stay untouched. Also confirm the init wrapper script is not removed by cleanup, and that `sync-ai` (see [initialization.md](../initialization.md#what-changes)) restores only generated framework instructions. Claude skills and documentation remain; Copilot prompts and theme-specific GitHub rules do not. Run POT generation separately to verify the language output can be recreated. +Check that the Copilot-specific `.github` files (`copilot-instructions.md`, `prompts/`, `instructions/`) and `languages` are removed, along with the starter's release workflow, config and manifest (`.github/workflows/release-starter.yml`, `.github/release-starter/`), while the other workflows, issue templates, and the PR template stay untouched. Also confirm the init wrapper script is not removed by cleanup, and that `sync-ai` (see [initialization.md](../initialization.md#what-changes)) restores only generated framework instructions. Claude skills and documentation remain; Copilot prompts and theme-specific GitHub rules do not. Run POT generation separately to verify the language output can be recreated. Check references in retained documentation and AI instructions. Use upstream source links for optional examples or starter-only files that cleanup may remove. Do not silently change the cleanup contract as part of a documentation correction. @@ -90,6 +90,16 @@ node /path/to/action-docusaurus-build/cli.mjs build \ Check the homepage, navigation order, root-guide links, anchors, and mobile layout. The builder fails on broken internal links and missing repository-file links. Also check external links and root Markdown, which are not fully covered by the site build. Update incoming links whenever a guide is moved or removed, and [record the results](#record-validation-results). +## Releasing the theme + +Releases of the theme itself are cut by [release-please](https://github.com/googleapis/release-please) (`.github/workflows/release-starter.yml`), from the config and manifest in `.github/release-starter/`. Init cleanup removes the workflow and that folder, so projects made from the starter don't inherit them; projects release by hand with `npm run release:bump` and `npm run release:changelog`. + +1. Pull requests are squash-merged, so each PR title becomes one Conventional Commit on `main`. release-please reads those subjects and keeps a release pull request open that bumps the version in `package.json`, `package-lock.json` and `style.css` (between the `x-release-please-start-version` and `x-release-please-end` lines), and writes the next `CHANGELOG.md` section. +2. The title's type decides the version: `fix:` is a patch, `feat:` a minor, and `feat!:` (or a `BREAKING CHANGE:` footer) a major. Anything that changes what init generates, renames a script or a file a project relies on, or raises a minimum version is a `feat!:`. `docs:`, `test:`, `ci:`, `chore:` and `refactor:` cut no release. Dependabot pull requests are prefixed `build` (see `.github/dependabot.yml`), which lists them under Changed and makes them releasable: `composer create-project` installs the latest tag, so a dependency fix only reaches new projects once it is released. Each merge only updates the open release pull request, so merge that when you want to release, for example after a batch of security updates. +3. When you want to release, run the [release validation](#release-validation) against the release pull request's branch, reword its entries if a title reads badly, then squash-merge it. release-please tags `vX.Y.Z` and publishes the GitHub release with that section as the notes. + +The release pull request is opened with `GITHUB_TOKEN`, so GitHub starts no workflow runs on it, and the PR title check is not a required status check for that reason. A GitHub App token in the workflow would give the release pull request its own runs. Never push a `v*` tag or edit `.github/release-starter/manifest.json` by hand. + ## Knowledge graph The graph is optional and may be stale. Verify exact behavior from current source when documenting it. For a deliberate artifact refresh, run local `graphify update .` and `graphify cluster-only . --no-label --no-viz`, then review the graph/report diff separately. Do not overwrite the theme's committed graph with a merged cross-repository graph during routine documentation work. diff --git a/style.css b/style.css index fad34d79..e8f2de62 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,9 @@ * Theme Name: Elementary Theme * Theme URI: https://rtcamp.com/ * Description: A modern starter theme for developing Full Site Editing (FSE) block-based WordPress themes with comprehensive developer tools and best practices. + * x-release-please-start-version * Version: 2.0.0 + * x-release-please-end * Author: rtCamp * Author URI: https://rtcamp.com/ * Tags: fse