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 publishing a release #691

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented 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
https://github.com/heroku/languages-team/pull/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.

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 the 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

GUS-W-14177169.
@edmorley edmorley self-assigned this Sep 25, 2023
@edmorley edmorley marked this pull request as ready for review September 25, 2023 11:23
@edmorley edmorley requested a review from a team as a code owner September 25, 2023 11:23
@edmorley edmorley merged commit f2dbe80 into main Sep 25, 2023
5 checks passed
@edmorley edmorley deleted the edmorley/release-workflow branch September 25, 2023 12:07
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.

Use GitHub Actions to perform new releases
2 participants