diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 808f69b99..d06c71db7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,14 +27,15 @@ on: workflow_dispatch: inputs: release-type: - description: "Release type (patch/minor/major)" + description: "Release type — 'auto' derives it from conventional commits since the last tag" type: choice required: true options: + - auto - patch - minor - major - default: patch + default: auto prerelease: description: "Prerelease channel (or 'none' for stable)" type: choice @@ -271,7 +272,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} run: | - ARGS="${{ inputs.release-type }} --ci" + # 'auto' → pass no increment so @release-it/conventional-changelog derives + # the bump (feat→minor, fix→patch, BREAKING/! →major) from the commits since + # the last tag. patch/minor/major stay available as an explicit override. + ARGS="--ci" + if [ "${{ inputs.release-type }}" != "auto" ]; then + ARGS="${{ inputs.release-type }} $ARGS" + fi if [ "${{ inputs.prerelease }}" != "none" ]; then ARGS="$ARGS --preRelease=${{ inputs.prerelease }}" fi diff --git a/RELEASING.md b/RELEASING.md index ad5d49aef..d35a489ea 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -7,7 +7,7 @@ Releases are cut from `main` via a GitHub Actions workflow. Only maintainers wit 1. Go to **Actions** → **Publish** in the repository. 2. Click **Run workflow**. 3. Choose inputs: - - **Release type**: `patch`, `minor`, or `major` (semver bump). + - **Release type**: `auto` (default) derives the semver bump from the conventional commits since the last tag. Pick `patch`, `minor`, or `major` only to force a specific bump. - **Prerelease channel**: - `none` — stable release (publishes to npm with tag `latest`). - `alpha`, `beta`, or `rc` — prerelease (publishes with matching npm tag). @@ -24,6 +24,20 @@ The workflow: - Publishes the updated packages to npm with the appropriate dist-tag. - Verifies the published dist-tags. +## Automatic version selection (`auto`) + +With `release-type: auto` you don't pick the bump — `@release-it/conventional-changelog` +computes it from the commit types since the last `vX.Y.Z` tag: + +- any `BREAKING CHANGE` / `!` → **major** +- any `feat` → **minor** +- otherwise (`fix`, `perf`, …) → **patch** + +**Breaking changes must be marked in the commit title.** Merges are squashed, so the +PR title becomes the only commit message and the PR body (and any `BREAKING CHANGE:` +footer) is dropped. A breaking change therefore has to use the `!` form in the PR +title — `feat(x)!: …` or `fix(x)!: …` — or `auto` will under-bump it to a minor/patch. + ## Release Cycles Typical paths through the workflow, assuming the repo is currently at `2.0.0-alpha.33`.