Skip to content

Commit f4eedce

Browse files
authored
[prdoc] Optional SemVer bumps and Docs (#3441)
Changes: - Add an optional `bump` field to the crates in a prdoc. - Explain the cargo semver interpretation for <1 versions in the release doc. --------- Signed-off-by: Oliver Tale-Yazdi <[email protected]>
1 parent f1b2189 commit f4eedce

File tree

2 files changed

+38
-7
lines changed

2 files changed

+38
-7
lines changed

docs/RELEASE.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ Rococo. To easily refer to a release, it shall be named by its date in the form
1818

1919
## Crate
2020

21-
We try to follow [SemVer 2.0.0](https://semver.org/) as best as possible for versioning our crates. SemVer requires a
22-
piece of software to first declare a public API. The public API of the Polkadot SDK is hereby declared as the sum of all
23-
crates' public APIs.
21+
We try to follow [SemVer 2.0.0](https://semver.org/) as best as possible for versioning our crates. The definitions of
22+
`major`, `minor` and `patch` version for Rust crates are slightly altered from their standard for pre `1.0.0` versions.
23+
Quoting [rust-lang.org](https://doc.rust-lang.org/cargo/reference/semver.html):
2424

25+
>Initial development releases starting with “0.y.z” can treat changes in “y” as a major release, and “z” as a minor
26+
release. “0.0.z” releases are always major changes. This is because Cargo uses the convention that only changes in the
27+
left-most non-zero component are considered incompatible.
28+
29+
SemVer requires a piece of software to first declare a public API. The public API of the Polkadot SDK
30+
is hereby declared as the sum of all crates' public APIs.
2531

2632
Inductively, the public API of our library crates is declared as all public items that are neither:
2733
- Inside a `__private` module

prdoc/schema_user.json

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
"$id": "https://raw.githubusercontent.com/paritytech/prdoc/master/prdoc_schema_user.json",
44
"version": {
55
"major": 1,
6-
"minor": 0,
7-
"patch": 0,
8-
"timestamp": 20230817152351
6+
"minor": 1,
7+
"patch": 0
98
},
109
"title": "Polkadot SDK PRDoc Schema",
1110
"description": "JSON Schema definition for the Polkadot SDK PR documentation",
@@ -125,10 +124,16 @@
125124
"name": {
126125
"type": "string"
127126
},
127+
"bump": {
128+
"$ref": "#/$defs/semver_bump"
129+
},
128130
"note": {
129131
"type": "string"
130132
}
131-
}
133+
},
134+
"required": [
135+
"name"
136+
]
132137
},
133138
"migration_db": {
134139
"type": "object",
@@ -165,6 +170,26 @@
165170
"description"
166171
]
167172
},
173+
"semver_bump": {
174+
"description": "The type of bump to apply to the crate version according to Cargo SemVer: https://doc.rust-lang.org/cargo/reference/semver.html. Please check docs/RELEASE.md for more information.",
175+
"oneOf": [
176+
{
177+
"const": "major",
178+
"title": "Major",
179+
"description": "A bump to the leftmost non-zero digit of the version number."
180+
},
181+
{
182+
"const": "minor",
183+
"title": "Minor",
184+
"description": "A bump to the second leftmost non-zero digit of the version number."
185+
},
186+
{
187+
"const": "patch",
188+
"title": "Patch",
189+
"description": "A bump to the third leftmost non-zero digit of the version number."
190+
}
191+
]
192+
},
168193
"doc": {
169194
"type": "object",
170195
"description": "You have the the option to provide different description of your PR for different audiences.",

0 commit comments

Comments
 (0)