Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: automate releases with Release-plz #545

Merged
merged 1 commit into from
Jun 7, 2024
Merged

chore: automate releases with Release-plz #545

merged 1 commit into from
Jun 7, 2024

Conversation

hds
Copy link
Collaborator

@hds hds commented Apr 12, 2024

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.

The previous scripts used to release have been removed.

Review Notes (DO NOT INCLUDE IN COMMIT MESSAGE)

To test the functionality of Release-plz, I copied console into a separate
project hds_console and played around with it there first.

The series of test PRs can be seen at: https://github.com/hds/hds_console/pulls?q=is%3Apr+is%3Aclosed

This released a series of test crates. The version history for each is:

The first release of each of the test crates was performed with the
existing release script. The subsequent releases were performed
by Release-Plz.

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.

The previous scripts used to release have been removed.

[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/
@hds hds marked this pull request as ready for review April 24, 2024 11:51
@hds hds requested a review from a team as a code owner April 24, 2024 11:51
@hds
Copy link
Collaborator Author

hds commented Apr 24, 2024

@hawkw What do you think about this workflow for releases? As mentioned, we will need to add a crates.io token to the action secrets on GitHub, but it would then allow releases entirely from here, no command line shenanigans needed (mostly).

@joshka
Copy link
Contributor

joshka commented Apr 25, 2024

This is the exact workflow (aside from the multiple package config) that I use for a bunch of tui related crates . It's fairly robust and works great. Being able to publish a release just by hitting merge on the release PR and trusting that everything is just handled correctly is an excellent workflow.

Copy link
Collaborator

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks! 👍

Thanks for testing it with your own repo.

@Rustin170506 Rustin170506 requested a review from hawkw May 26, 2024 12:45
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks for working on this!

It might be nice to add some documentation to CONTRIBUTING.md (or something) explaining the new release workflow and how to trigger a release, but it's fine to add that in a separate PR.

Do we need to export a cargo registry token secret in the repo settings for the release-plz action to use? I can go do that.

@hds hds merged commit 99437b0 into main Jun 7, 2024
17 checks passed
@hds hds deleted the hds/release-plz branch June 7, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants