Skip to content

Commit

Permalink
chore: automate releases with Release-plz
Browse files Browse the repository at this point in the history
Releasing the console crates has been a bit of a hassle. It requires
manual work run locally and as such, we have gone long periods without
releases, despite having changes which would be worth releasing.

[Release-plz] provides release automation based on GitHub actions. It
will create, and then update a PR for the next release.

Release-plz depends on [conventional commits] (which the `console`
project is already following) to determine the next version number for
each crate and then uses [cargo-semver-checks] to check that the version
bump is correct.

For the changelogs, [git-cliff] is used. Since we already started using
in #416, so we can reuse our existing `cliff.toml` config file. A small
change has been made to remove the footer, as it was getting included
multiple times in a single changelog file due to the delta updates.

**Caution**: In order to use Release-plz, a crates.io token first needs
to be added to the GitHub project. This means that anyone with PR merge
rights will be able to run a release by merging the Release PR.
Additionally, GitHub actions need to be given permission to create PRs.

[Release-plz]: https://release-plz.ieni.dev/
[conventional commits]: https://www.conventionalcommits.org/en/v1.0.0/
[cargo-semver-checks]: https://github.com/obi1kenobi/cargo-semver-checks
[git-cliff]: https://git-cliff.org/
  • Loading branch information
hds committed Apr 12, 2024
1 parent 74331e1 commit ff426dc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release-plz

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- main

jobs:
release-plz:
name: Release-plz
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
4 changes: 1 addition & 3 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ body = """
# remove the leading and trailing whitespace from the template
trim = true
# changelog footer
footer = """
<!-- generated by git-cliff -->
"""
footer = ""

[git]
# parse the commits based on https://www.conventionalcommits.org
Expand Down
11 changes: 11 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[workspace]
changelog_config = "cliff.toml"

[[package]]
name = "console-api"

[[package]]
name = "console-subscriber"

[[package]]
name = "tokio-console"

0 comments on commit ff426dc

Please sign in to comment.