Skip to content

Commit ed1b3d8

Browse files
GabrielMajerinicholasbishop
authored andcommitted
Document how to publish new versions of the crates
1 parent 802ed26 commit ed1b3d8

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,8 @@ impl NewProtocol {
132132
```
133133

134134
[fork]: https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo
135+
136+
## Publishing new versions of the crates
137+
138+
Maintainers of this repository might also be interested in [the guidelines](CONTRIBUTING.md)
139+
for publishing new versions of the uefi-rs crates.

PUBLISHING.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Publishing new versions of uefi-rs to Crates.io
2+
3+
This guide documents the best practices for publishing new versions of
4+
the crates in this repository to [crates.io](https://crates.io/).
5+
6+
**It is mostly intended for maintainers of the uefi-rs project.**
7+
8+
## Before bumping the crate versions
9+
10+
It is a good idea to occasionally update/refresh the dependencies of the uefi-rs crates,
11+
even if we don't necessarily need a bugfix included in one of them.
12+
13+
This can be done easily by using the [`cargo upgrade`][cargo-upgrade] tool.
14+
15+
[cargo-upgrade]: https://crates.io/crates/cargo-edit#cargo-upgrade
16+
17+
## Bumping the crate versions
18+
19+
For ensuring compatibility within the crates ecosystem,
20+
Cargo [recommends][cargo-semver] maintainers to follow the [semantic versioning][semver] guidelines.
21+
22+
This means that before publishing the changes, we need to decide
23+
which crates were modified and how should their version numbers be incremented.
24+
25+
Incrementing the version number of a crate is as simple as editing
26+
the corresponding `Cargo.toml` file and updating the `version = ...` line,
27+
then commiting the change (preferrably on a new branch, so that all of the version bumps
28+
can be combined in a single pull request).
29+
30+
### Crate dependencies
31+
32+
The dependency graph of the published crates in this repo is:
33+
34+
```
35+
uefi-macros <-- uefi (root project) <-- uefi-services
36+
```
37+
38+
which suggests that, if there are breaking changes happening in the project,
39+
we should first process/publish a new version of `uefi-macros`, then of `uefi`,
40+
then of `uefi-services` and so on.
41+
42+
For example, if the signature of a widely-used macro from `uefi-macros` is changed,
43+
a new major version of that crate will have to be published, then a new version of
44+
`uefi` (major if the previous bump caused changes in the public API of this crate as well),
45+
then possibly a new version of `uefi-services`.
46+
47+
Furthermore, `uefi-macros` has the `uefi` crate as a `dev-dependency`,
48+
and that will have to be updated in tandem with the major versions of the core crate.
49+
50+
### Updating the dependent crates
51+
52+
Remember that if a new major version of a crate gets released, when bumping the version
53+
of it's dependents you will have to also change the dependency line for it.
54+
55+
For example, if `uefi-macros` gets bumped from `1.1.0` to `2.0.0`,
56+
you will also have to update the corresponding `Cargo.toml` of `uefi` to be:
57+
58+
```toml
59+
uefi-macros = "2.0.0"
60+
```
61+
62+
[cargo-semver]: https://doc.rust-lang.org/cargo/reference/semver.html
63+
[semver]: https://semver.org/
64+
65+
## Publishing new versions of the crates
66+
67+
This section is mostly a summary of the official [guide to publishing on crates.io][cargo-publishing-reference],
68+
with a few remarks regarding the specific of this project.
69+
70+
Start by following the steps in the guide. When running `cargo publish`,
71+
you will have to use a custom `--target` flag to be able to build/verify the crates:
72+
73+
```
74+
cargo publish --target x86_64-unknown-uefi
75+
```
76+
77+
[cargo-publishing-reference]: https://doc.rust-lang.org/cargo/reference/publishing.html
78+

0 commit comments

Comments
 (0)