This guide documents how to publish new versions of the crates in this repository to crates.io.
It is mostly intended for maintainers of the uefi-rs project.
- We want precise entries in the
CHANGELOG.md
for every release that follow our existing format. Changes are supposed to be added before a release is performed. - We want git tags like
uefi-raw-v0.4.0
oruefi-v0.25.0
for every release. - We want our crate dependencies published in the right order (if necessary):
uefi
depends onuefi-macros
anduefi-raw
There are two major ways for releasing/publishing.
- Create a branch that updates the versions of all packages you want to release. This branch should include all related changes such as updating the versions in dependent crates and updating the changelog.
- Create a PR of that branch. The subject of the PR must start with
release:
, the rest of the message is arbitrary. Example - Once the PR is approved and merged, a GitHub Actions workflow will take care of creating git tags and publishing to crates.io.
The release.yml
workflow expects a repository secret named
CARGO_REGISTRY_TOKEN
. This is set in the repository settings. The
value must be a crates.io API token. The scope of the token should be
restricted to publish-update
.
To simplify things, you can use the cargo-release
utility, which automatically bumps crate versions in Cargo.toml
, creates
git tags as we want them, and creates a release commit. If you prefer a more
manual process, create the tags manually so that it matches the existing git tag
scheme.
The following guide assumes that you are using cargo-release
.
- Make sure that the
main
branch passes CI. Also verify that locally by runningcargo xtask test && cargo xtask run
. - Create an issue similar to #955 for noting what you want to release.
- Make sure that the
CHANGELOG.md
is up-to-date and matches the format. - Perform a dry run:
cargo release -p uefi-raw 0.4.0
Hint:cargo-release
will automatically increase the version number for you, if it is still lower. - Release:
cargo release -p uefi-raw 0.4.0 --execute
- Update the lock file:
cargo xtask build
- If necessary: Bump the dependency in the dependent crates, commit this, and
if applicable release them. Go back to
4.
for that. - Search the repository for outdated versions, such as in
template/Cargo.toml
. Runcargo xtask build
again and update + commit the lock file, if there are changes. - Submit a PR. Make sure to push all tags using
git push --tags
. - Update this document, in case something is inconvenient or unclear.
Make sure to be familiar with the general publishing principals for crates.io.
For ensuring compatibility within the crates ecosystem, Cargo recommends maintainers to follow the semantic versioning guidelines.
This means that before publishing the changes, we need to decide which crates were modified and how should their version numbers be incremented.
Note that 0.x
-> 0.(x+1)
is allowed to be a breaking change by Cargo.