Skip to content
Merged
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
8 changes: 6 additions & 2 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Release-plz

# Keeps the release PR up to date on every push to main.
# Run by hand (workflow_dispatch) to open or update the release PR.
# When the release PR is merged, publishes the crates to crates.io, tags each
# released package and creates its GitHub release; the tags trigger the
# workflows that upload the binaries and publish to PyPI and npm.
Expand Down Expand Up @@ -55,7 +55,11 @@ jobs:
name: Update the release PR
# After `release`, so that versions just published are on crates.io.
needs: [release]
if: ${{ !failure() && !cancelled() && github.repository_owner == 'cpp-linter' }}
# Only when run by hand, so that a release is prepared only when we want one.
if: >-
!failure() && !cancelled()
&& github.repository_owner == 'cpp-linter'
&& github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
Expand Down
19 changes: 15 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ nur docs --build

Releases are prepared by [release-plz] (see `release-plz.toml`).

1. On every push to `main`, release-plz opens or updates a release PR titled
1. To prepare a release, run the "Release-plz" workflow by hand (Actions →
Release-plz → Run workflow). It opens or updates a release PR titled
"chore: release". It bumps the versions from the conventional commit
messages (`fix` → patch, `feat` → minor, `!` → major) and adds the
changelog entries.
changelog entries. A package is only bumped if it has a `feat`, `fix` or
`perf` commit since its last release (dependency, docs and CI changes alone
do not release it). Run the workflow again to refresh the PR after more
commits land on `main`.
2. cpp-linter, cpp-linter-py and cpp-linter-js always get the same version.
clang-tools-manager has its own version.
3. The release PR is a draft. Mark it ready for review to run the release
Expand All @@ -118,14 +122,21 @@ A new tag starts the tag-triggered builds; if the tag already existed,
re-run its failed jobs instead.

To choose a version yourself (e.g. to start or end release candidates),
open a PR that sets it (needs [cargo-edit]):
open a PR titled `build: set version to <version>` that sets it (needs
[cargo-edit]). Keep that title: it is what lets release-plz release the new
version when there is no other `feat`, `fix` or `perf` commit.

```sh
cargo set-version -p cpp-linter -p cpp-linter-py -p cpp-linter-js 2.0.0
.github/sync-node-version.sh
```

After it is merged, the release PR keeps that version.
After it is merged, run the workflow; the release PR keeps that version.
Comment thread
shenxianpeng marked this conversation as resolved.
Resolved

For 2.0.0, edit the cpp-linter changelog in the release PR before merging it:
crates.io still has the old `2.0.0-rc1` to `2.0.0-rc15` versions, which sort
after `2.0.0-rc.28` in semver, so release-plz takes `2.0.0-rc9` as the previous
version and lists commits that earlier release candidates already shipped.

[nur]: https://nur-taskrunner.github.io/docs/
[release-plz]: https://release-plz.dev/
Expand Down
16 changes: 11 additions & 5 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Configuration for release-plz (https://release-plz.dev/docs/config).
#
# On every push to main, release-plz keeps one release PR up to date
# (version bumps + changelogs). Merging that PR makes release-plz push one
# `{package}/v{version}` tag per released package and create its GitHub release.
# Those tags trigger the deploy workflows, as before:
# - binary-builds.yml: crates.io + binaries (cpp-linter, clang-tools-manager)
# Running the Release-plz workflow by hand opens or updates one release PR
# (version bumps + changelogs). Merging that PR makes release-plz publish the
# crates to crates.io, push one `{package}/v{version}` tag per released package
# and create its GitHub release. Those tags trigger the deploy workflows:
# - binary-builds.yml: binaries (cpp-linter, clang-tools-manager)
# - python-packaging.yml: PyPI, or TestPyPI for pre-releases (cpp-linter-py)
# - node-js-packaging.yml: npm, `next` dist-tag for pre-releases (cpp-linter-js)

Expand All @@ -15,6 +15,11 @@ publish = false
semver_check = false
# Only release when a release PR (branch `release-plz-*`) is merged.
release_always = false
# Only prepare a release when a package has a feat, fix or perf commit, so
# that dependency updates (incl. Cargo.lock-only ones), docs and CI changes
# alone do not bump the version. A commit titled "build: set version to ..."
# (see CONTRIBUTING.md) also counts, so a version set by hand is released.
release_commits = "^(feat|fix|perf)|^build: set version to "
# Open the release PR as a draft; marking it ready for review runs the
# release builds (binary-builds, python-packaging, node-js-packaging) on it.
pr_draft = true
Expand Down Expand Up @@ -121,6 +126,7 @@ commit_preprocessors = [
]
commit_parsers = [
{ message = "^build: bump version to ", skip = true },
{ message = "^build: set version to ", skip = true },
{ message = "^chore: release", skip = true },
{ field = "breaking", pattern = "true", group = "<!-- 0 --> 💥 Breaking changes" },
{ field = "group", pattern = "^(add|feat)$", group = "<!-- 1 --> 🚀 Added" },
Expand Down