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

Add a GitHub Actions workflow for preparing a libcnb.rs release #689

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

edmorley
Copy link
Member

Libcnb.rs uses a two stage release process. Until now both of those stages required a maintainer to perform the steps manually:
https://github.com/heroku/libcnb.rs/blob/main/RELEASING.md

This new GitHub Actions workflow replaces the manual steps in the first half of the release process, leading up to the creation of the "Prepare release" PR.

In the future, the second stage of the release process will be automated too, but that will require sorting out a service account (which will also have to be backed by a GitHub account, since currently crates.io only supports login via GitHub oauth).

See also:
https://github.com/killercup/cargo-edit#cargo-set-version
https://github.com/heroku/languages-github-actions/blob/main/.github/workflows/_buildpacks-release.yml

First part of #595.
GUS-W-13977983.

Libcnb.rs uses a two stage release process. Until now both of those
stages required a maintainer to perform the steps manually:
https://github.com/heroku/libcnb.rs/blob/main/RELEASING.md

This new GitHub Actions workflow replaces the manual steps in the first
half of the release process, leading up to the creation of the
"Prepare release" PR.

In the future, the second stage of the release process will be automated
too, but that will require sorting out a service account (which will also
have to be backed by a GitHub account, since currently crates.io only
supports login via GitHub oauth).

See also:
https://github.com/killercup/cargo-edit#cargo-set-version
https://github.com/heroku/languages-github-actions/blob/main/.github/workflows/_buildpacks-release.yml

First part of #595.
GUS-W-13977983.
@edmorley edmorley self-assigned this Sep 24, 2023
@edmorley edmorley marked this pull request as ready for review September 24, 2023 14:25
@edmorley edmorley requested a review from a team as a code owner September 24, 2023 14:25
Copy link
Member

@Malax Malax left a comment

Choose a reason for hiding this comment

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

Neat!

@edmorley edmorley merged commit f79c1e2 into main Sep 25, 2023
5 checks passed
@edmorley edmorley deleted the edmorley/prepare-release-workflow branch September 25, 2023 08:53
edmorley added a commit that referenced this pull request Sep 25, 2023
In #689, a GitHub Actions workflow was added for the first stage
of the release process - preparing the release PR.

Now, another workflow has been added for the second stage of
the release process - publishing to https://crates.io and creating
the GitHub Release.

This workflow makes use of the `cargo-release` tool, which calculates
the crate dependency graph for us, so we don't need to hardcode a
crate publish ordering:
https://github.com/crate-ci/cargo-release/blob/master/docs/reference.md

This tool also skips any already-published crates, so if say a release failed
halfway through publishing to crates.io, the job could be retriggered
and would successfully resume publishing.

The new workflow does however perform a single check to see if the
GitHub Release already exists, to prevent accidentally re-running an
already completed successfully release (which might move the git
tag):
https://cli.github.com/manual/gh_release_view

Credentials are configured via the `CARGO_REGISTRY_TOKEN` env var,
which has been set to the scoped crates.io API token of a service account.
That service account has already been added to the `libcnb*` and
`libherokbuildpack` crates:
https://doc.rust-lang.org/cargo/reference/config.html#credentials
https://crates.io/users/heroku-languages-release-bot
heroku/languages-team#146

The awk-based changelog extraction technique was inspired by:
https://stackoverflow.com/questions/38972736/how-to-print-lines-between-two-patterns-inclusive-or-exclusive-in-sed-awk-or

Closes #595.
GUS-W-14177169.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants