diff --git a/.agents/rules/releases-use-script.md b/.agents/rules/releases-use-script.md index 1895456..be35c6f 100644 --- a/.agents/rules/releases-use-script.md +++ b/.agents/rules/releases-use-script.md @@ -1,6 +1,6 @@ -# Releases Must Use Script +# Release preparation -When the user asks for a "new release" (or equivalent wording), always use `.github/scripts/release.sh` from the repository root. +This repository uses Release Please. Until its `release-please` job is activated (the pause condition in `.github/workflows/release.yml`), no release PR exists: do not release. The script procedure below applies to legacy callers without a root `release-please-config.json`. - Determine bump type (`major`, `minor`, or `patch`) from user intent. - If bump type is unclear, ask a single clarifying question before running the script. @@ -16,6 +16,6 @@ Release-please repositories (a `release-please-config.json` exists at the root) - If auto-merge is refused or stays blocked, never merge the release PR directly without the user's agreement. - The exception covers only that auto-merge. Releases made with `release.sh`, pin bumps, manual tags and other repositories keep the confirmation rule above. -Examples: +Examples for legacy script callers: - "new release" -> ask whether `major`, `minor`, or `patch`, then run `.github/scripts/release.sh `. - "cut a patch release" -> run `.github/scripts/release.sh patch`. diff --git a/.github/workflows/check-pr-title.yml b/.github/workflows/check-pr-title.yml new file mode 100644 index 0000000..9d66567 --- /dev/null +++ b/.github/workflows/check-pr-title.yml @@ -0,0 +1,17 @@ +name: PR title + +on: + pull_request: + branches: [main] + types: [opened, edited, synchronize, reopened] + +permissions: + pull-requests: read + +concurrency: + group: check-pr-title-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +jobs: + pr-title: + uses: BehindTheMusicTree/github-workflows/.github/workflows/pr-title.yml@18b90bc9c64b9abab0a86e7ea74f65acac93aec1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 469fe61..8c2b3d9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release tag +name: Release on: push: @@ -15,8 +15,20 @@ jobs: release-tag: permissions: contents: write - uses: BehindTheMusicTree/github-workflows/.github/workflows/release-tag.yml@ec2bc59ca49b34ab63cf712c9da5201b73d749db + uses: BehindTheMusicTree/github-workflows/.github/workflows/release-tag.yml@18b90bc9c64b9abab0a86e7ea74f65acac93aec1 with: app-id: ${{ vars.RELEASE_APP_ID }} secrets: release-app-private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }} + + release-please: + # Keep preparation paused until App access and the title check are in place. + if: vars.WORKFLOWS_RELEASE_PLEASE_ENABLED == 'true' + needs: release-tag + uses: BehindTheMusicTree/github-workflows/.github/workflows/release-please.yml@18b90bc9c64b9abab0a86e7ea74f65acac93aec1 + with: + app-id: ${{ vars.RELEASE_PR_APP_ID }} + release-policies: .github/release-policy.json + auto-merge: true + secrets: + release-pr-app-private-key: ${{ secrets.RELEASE_PR_APP_PRIVATE_KEY }} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..7d222f8 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1 @@ +{".": "6.6.0"} diff --git a/AGENTS.md b/AGENTS.md index 3eebdee..b552ee4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,4 +2,4 @@ This repository maintains reusable GitHub Actions workflows and composite actions. Follow [CONTRIBUTING.md](CONTRIBUTING.md) for GitHub Flow, testing, and changelog requirements. Changes to reusable workflows can affect all callers. -Run `actionlint` for workflow changes and the relevant tests in `.github/actions/*/tests/`. Before changing `.github/scripts/release.sh`, `CHANGELOG.md` or `VERSION`, or for any release, read `.agents/rules/releases-use-script.md` and follow the documented `.github/scripts/release.sh` procedure. +Run `actionlint` for workflow changes and the relevant tests in `.github/actions/*/tests/`. Before changing `.github/scripts/release.sh`, `CHANGELOG.md` or `VERSION`, or for any release, read `.agents/rules/releases-use-script.md` and follow the documented procedure for the repository's release configuration. diff --git a/CHANGELOG.md b/CHANGELOG.md index 31abdc9..40a2be2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [Post-release documentation for v6.6.0](https://github.com/BehindTheMusicTree/github-workflows/compare/v6.6.0...c3ac3ea8b6c05094c8d14e47b884a150711bc768) ### Documentation diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 08ef087..87a6058 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,7 +45,6 @@ The maintainer(s) are responsible for: - Ensuring code quality and project direction - Responding to critical issues - Maintaining the project's infrastructure (GitHub Actions) -- Moving "Unreleased" changelog entries to versioned sections during releases **Important:** Even maintainers must go through Pull Requests. No direct commits to `main` are allowed — all changes, including those from maintainers, must be submitted via Pull Requests and go through the standard review process. @@ -60,7 +59,6 @@ The maintainer(s) are responsible for: - Propose changes to workflows, scripts, and docs via Pull Requests - Report issues or suggest improvements via GitHub Issues -- Update CHANGELOG in the `[Unreleased]` section when contributing **What contributors cannot do:** @@ -149,7 +147,7 @@ We use **GitHub Flow**: one main branch (`main`) and topic branches. No `develop - `feat: add prod environment support to redeploy webhook` - `docs: add webhook call vars/secrets reference` - `fix: handle empty variable values in config check` - - `chore: align changelog Unreleased` + - `chore: align workflow pins` ### 5. Pull Request Process @@ -166,7 +164,7 @@ Before submitting a Pull Request: **2. Documentation** - [README.md](README.md) updated if you changed behavior or setup -- [CHANGELOG.md](CHANGELOG.md) updated: add your changes under the `[Unreleased]` section +- Use a conventional PR title for the generated [CHANGELOG.md](CHANGELOG.md). Release Please updates the changelog and version in the release PR. **3. Git** @@ -184,15 +182,9 @@ After opening the PR, maintainers will review and may request changes. Once appr ### 6. Releasing _(For Maintainers)_ -Releases are made from `main`. +Release Please prepares releases from conventional PR titles squash merged into `main`. Use `fix:` for a patch, `feat:` for a minor release, and `!` for a breaking change. Keep `CHANGELOG.md` and `VERSION` edits in the generated release PR. -1. Create a feature branch from an up-to-date `main`. -2. Run `.github/scripts/release.sh minor` (or `patch` / `major`) on the feature branch. The script updates the changelog and version and commits them without creating a tag. -3. Push the branch, open a PR to `main`, and merge it after review and checks. -4. CI validates the release policy, canonical `VERSION`, nonempty matching changelog notes and main ancestry. It creates an annotated tag on the exact merged commit through the release App. -5. The tag workflow publishes the GitHub Release using those changelog notes. Rerun a failed workflow to recover; an existing release is retained. Local `publish` is refused once `.github/release-policy.json` is present. - -Repositories that prepare releases with release-please (`release-please-config.json` at the root) do not edit `CHANGELOG.md` or `VERSION` in feature or release changes: use conventional PR titles; the caller passes `auto-merge: true` (required by github-config), so CI merges the generated release PR once the required checks pass. See the README section "Release preparation with release-please". +The release caller sets `auto-merge: true`. GitHub squash merges the release PR once the required checks pass. The main-push workflow validates the version and changelog, creates the annotated tag on the squash commit, and publishes the GitHub Release. Rerun the original main-push workflow to recover from a tagging or publication failure. #### Choosing the version @@ -200,7 +192,7 @@ Repositories that prepare releases with release-please (`release-please-config.j - Exception, **minor**: the caller inventory (an org search recorded in the PR) shows either no user, or that every affected caller has an identified migration to make in its bump PR. The changelog then names the migration under `Changed` ("Migration: ..."). - Precedents: v6.5.0 (legacy CI form, 30 callers already migrated), the release carrying this rule (stale `event` exemptions in 7 repositories, removed in their bump PRs). -Initial adoption keeps version 5.0.1 and creates no tag. App access and tag protections are activated separately in `github-config` before preparing a subsequent release. The reusable workflows in this repository remain pinned by consumers; this adoption does not repin them. +Release Please starts from v6.6.0. Consumers update their reusable workflow pins in their own repositories. ## License & Attribution diff --git a/README.md b/README.md index da5720e..fc4507b 100644 --- a/README.md +++ b/README.md @@ -196,8 +196,10 @@ Practical notes for a workspace whose root depends on a published member: `dependencies`. - The root range must therefore be widened in the same PR as every minor bump of the member (a `fix:` change touching the root manifest and `uv.lock`). -- A `docs:` commit is included in the changelog by release-please and opens a release PR; - use `chore:` for a change that must not release. +- Release Please's default sections hide `docs:` commits, so a `docs:` change does not open + a release PR (verified against the pinned action and real docs commits); types shown + in its default sections (`feat:`, `fix:`, `perf:`, `revert:`) and breaking changes do. + Use `chore:` for any other change. ### Org conformance @@ -660,7 +662,7 @@ Before enabling a caller, configure separate tag rulesets: creation permits the Activation and changes to the contract must land in a separate push from a version bump. Activation validates the current version, mirrors and changelog but never tags it, including an existing version with no tag. A subsequent push with no bump also produces no tag. For an established contract, a bump must increase the version and leave the policy unchanged; all mirrors and its changelog section must match. The version comparison uses the push's before/after commits, never the current branch tip. Force pushes and newly created branch events fail closed. -Prepare version and changelog in a PR using the project's own tools. In this repository, `.github/scripts/release.sh major|minor|patch` prepares a commit on a feature branch. **Deprecated:** `release.sh` as a local release procedure is replaced by [release-please](#release-preparation-with-release-please) for adopters, and is refused once `release-please-config.json` exists. Its legacy `publish` command remains available to repositories without the CI policy; once `.github/release-policy.json` exists, manual publication is refused. This repository declares its own `VERSION` policy and uses pinned callers for tagging and GitHub publication. Initial adoption keeps version 5.0.1 and produces no tag; App access and protections are activated separately in `github-config`. +This repository uses [Release Please](#release-preparation-with-release-please) to prepare changes to its `VERSION` and changelog. Its pinned release workflow tags and publishes GitHub Releases. For consumers that still prepare releases with the legacy script, `.github/scripts/release.sh major|minor|patch` prepares a commit on a feature branch. The script refuses once `release-please-config.json` exists. Its legacy `publish` command is available only to repositories without `.github/release-policy.json`. Validation runs without App secrets and checks ancestry against fetched `origin/main`. A separate runner checks out only this repository's shared implementation at an immutable SHA, checks configuration, then requests an App token scoped to the caller repository and Contents write. The App-token action revokes it in its post step. No caller script or build runs in that job. The helper checkouts use `job.workflow_sha`, the commit of this reusable workflow that the caller pinned, after a guard step requires a 40-hex SHA and `job.workflow_repository` equal to `BehindTheMusicTree/github-workflows`. Scripts therefore always match the reviewed workflow and a Python change needs no second self-pin; each caller still pins the outer workflow independently. diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..b06e6e1 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,10 @@ +{ + "bootstrap-sha": "18b90bc9c64b9abab0a86e7ea74f65acac93aec1", + "packages": { + ".": { + "release-type": "simple", + "version-file": "VERSION", + "include-component-in-tag": false + } + } +}