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

Use GitHub Actions to perform new releases #595

Closed
edmorley opened this issue Jul 12, 2023 · 0 comments · Fixed by #691
Closed

Use GitHub Actions to perform new releases #595

edmorley opened this issue Jul 12, 2023 · 0 comments · Fixed by #691
Assignees
Labels
enhancement New feature or request

Comments

@edmorley
Copy link
Member

edmorley commented Jul 12, 2023

Currently new libcnb.rs releases are performed via a sequence of locally run manual steps:
https://github.com/heroku/libcnb.rs/blob/main/RELEASING.md

We should (a) automate these, (b) perform them on GitHub Actions, in order to:

  1. Reduce the chance of error
  2. Reduce the toil for performing new releases
  3. Improve security over using local creds
  4. Allow for running tools to lint things like the semver bump before release (Use cargo-semver-checks to validate version bumps for new releases #596)

We might be able to make use of one or more of these tools:
https://github.com/killercup/cargo-edit#cargo-set-version
https://github.com/crate-ci/cargo-release
https://github.com/Byron/cargo-smart-release

@edmorley edmorley added the enhancement New feature or request label Jul 12, 2023
@edmorley edmorley self-assigned this Aug 19, 2023
edmorley added a commit that referenced this issue Sep 25, 2023
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 added a commit that referenced this issue 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
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant