Skip to content

Commit 297c4f3

Browse files
committed
docs/make-release.md: Added info about deciding between major, minor, patch, and prerelease when choosing a version number.
1 parent ab7f0b1 commit 297c4f3

1 file changed

Lines changed: 80 additions & 10 deletions

File tree

docs/make-release.md

Lines changed: 80 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
- [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
3131
- [nbgv tool](https://www.nuget.org/packages/nbgv/) (the version must match the one defined in [Directory.Packages.props](../Directory.Packages.props))
3232
- [Java 8](https://adoptium.net/temurin/releases) or higher (either a JRE or JDK)
33-
- Bash. If on Windows, this will automatically be installed by [Git for Windows](https://gitforwindows.org/).
33+
- Bash (Installed automatically with [Git for Windows](https://gitforwindows.org/) on Windows).
3434

3535
### Installing the NBGV Tool
3636

@@ -67,6 +67,10 @@ Repeat the first command to confirm that it is set.
6767

6868
This project uses Nerdbank.GitVersioning to assist with creating version numbers based on the current branch and commit. This tool handles making pre-release and production releases on release branches.
6969

70+
### Release Workflow Overview
71+
72+
![Release Workflow](images/release-workflow.svg)
73+
7074
### Prepare the Main Branch
7175

7276
1. Ensure all of the features that will be included have been merged to the `main` branch.
@@ -75,18 +79,59 @@ This project uses Nerdbank.GitVersioning to assist with creating version numbers
7579

7680
If any changes are required, it is recommended to use feature branch(es) and pull request(s) to update the `main` branch as appropriate before creating a release branch.
7781

78-
## Create a Release Branch
82+
### Decide on a Release Version
7983

80-
### Release Workflow Overview
84+
The version that will be released next is controlled by the `version.json` file. We must choose the release version and commit it to the `main` branch prior to creating a release branch.
8185

82-
![Release Workflow](images/release-workflow.svg)
86+
> [!NOTE]
87+
> If you are not familiar with these terms, these are covered in the [Semantic Versioning 2.0](https://semver.org/spec/v2.0.0.html) document.
88+
89+
For the purposes of this project:
90+
91+
- **Major (Advanced)** - Released only when a new port of Lucene.NET is started (primarily to show a relationship between Lucene.NET and these analyzers)
92+
- **Minor** - A typical release with one or more new features
93+
- **Patch** - A release that only contains patches to existing features and/or updates to documentation
94+
- **Prerelease** - A release that requires stabilization or is a one-off release for a specific purpose
95+
96+
> [!NOTE]
97+
> This project doesn't have any public API that users consume, so the type of release is strictly informational in nature, not functional.
98+
99+
Now is the time to decide which of these strategies to use for the current version. For the next version (a future release version), we should always assume a patch. This is primarily so we never have to downgrade a version even if a patch is rarely done in practice.
100+
101+
With that in mind, open `version.json` and look at the "version" property, which will determine next version that will be released.
102+
103+
#### Example Version
104+
105+
```json
106+
"version": "2.0.0-alpha.{height}"
107+
```
108+
109+
The above example shows that the next version that will be released from a release branch is 2.0.0 or 2.0.0-beta.x (where x is an auto-incrementing number). The actual version in the file (alpha) will be used only if the `main` branch is released directly (something that is rare and not covered here).
110+
111+
If we are releasing new features and want the next Minor version (2.1.0), we need to update the `version.json` file to reflect that version.
112+
113+
```json
114+
"version": "2.1.0-alpha.{height}"
115+
```
116+
117+
Or, if the next version will be a patch, then leave the file unchanged. Commit any changes to the `main` branch and push them upstream before proceeding.
118+
119+
Prereleases should rarely need to change the `version.json` file and will later choose the [Requires Stabilization](#requires-stabilization) option when creating a release branch.
120+
121+
> [!IMPORTANT]
122+
> Release version numbers must always use all 3 version components when specified in `version.json`.
123+
124+
## Create a Release Branch
83125

84126
There are 2 supported scenarios for the release workflow:
85127

86128
1. [Ready to Release](#ready-to-release) - No additional stabilization is required
87129
2. [Requires Stabilization](#requires-stabilization) - A beta will be released, which will be marked as a pre-release to consumers
88130

89-
<!-- TODO: Add Versioning Primer link here -->
131+
> [!NOTE]
132+
> In both cases, `main` is advanced to the specified `--nextVersion`. This number should always be a **patch** bump and it should always use all 3 version components (major.minor.patch).
133+
>
134+
> The release branch name is always based on the version being released (e.g., `release/v2.0.0`).
90135
91136
### Ready to Release
92137

@@ -122,7 +167,15 @@ release/v2.0.0 branch now tracks v2.0.0-beta.{height} stabilization and release.
122167
main branch now tracks v2.0.1-alpha.{height} development.
123168
```
124169

125-
The tool created a release branch named `release/v2.0.0`. Every build from this branch will be given a unique pre-release version starting with 2.0.0-beta and ending in a dot followed by one or more digits.
170+
The tool created a release branch named `release/v2.0.0`. Every commit to this branch will be given a unique pre-release version starting with 2.0.0-beta and ending in a dot followed by one or more digits (i.e. `2.0.0-beta.123`).
171+
172+
### Checkout the Release Branch
173+
174+
After the release branch is created, the rest of the commits will be added to the release branch, so use the git checkout command to switch to that branch.
175+
176+
```console
177+
git checkout <release-branch>
178+
```
126179

127180
---------------------------------------------
128181

@@ -157,7 +210,7 @@ Roslyn analyzers use two release tracking files to manage analyzer rule metadata
157210
- **`AnalyzerReleases.Shipped.md`**
158211
Tracks analyzer rules that have been released in one or more shipped packages. This is the authoritative record of rules shipped at specific versions.
159212

160-
Before tagging the release, you must ensure that these files are up to date. This guarantees that the release metadata reflects the rules included in the NuGet package.
213+
Before tagging the release, you must ensure that these files are up to date. This ensures that the release metadata exactly matches the rules shipped in the NuGet package.
161214

162215
> [!NOTE]
163216
> If the release doesn't contain new or changed analyzer rules, this step can be skipped. For example, if the release only contains new code fixes and/or backward compatible patches to existing analyzers.
@@ -245,20 +298,20 @@ Tagging the commit and pushing it to the GitHub repository will start the automa
245298

246299
#### Tag the HEAD Commit
247300

248-
Run the following command to tag the HEAD commit.
301+
Run the following command to tag the HEAD commit of the release branch.
249302

250303
```console
251304
nbgv tag
252305
```
253306

254307
> [!NOTE]
255-
> The release build workflow always uses the HEAD commit.
308+
> The release build workflow always builds from the HEAD commit of the release branch.
256309
257310
#### Push the Release Branch to the Upstream Repository
258311

259312
The final step to begin the release build is to push the tag and any new commits to the upstream repository.
260313

261-
```c#
314+
```console
262315
git push <remote-name> <release-branch> --follow-tags
263316
```
264317

@@ -285,6 +338,8 @@ Review the draft release notes and edit or regenerate them if necessary. Release
285338

286339
##### Labels that Apply to the Release Notes
287340

341+
The following labels are recognized by the release notes generator.
342+
288343
| GitHub Label | Action |
289344
|--------------------------------|----------------------------------------------------------|
290345
| notes:ignore | Removes the PR from the release notes |
@@ -353,12 +408,27 @@ Next, follow the same procedure starting at [Tag the HEAD Commit](#tag-the-head-
353408

354409
Finally, merge the release branch back into the main branch and push the changes to the upstream repository.
355410

411+
> [!IMPORTANT]
412+
> Release branches start with `release\v`.
413+
356414
```console
357415
git checkout main
358416
git merge <release-branch>
359417
git push <remote-name> main
360418
```
361419

420+
### Delete the Release Branch
421+
422+
From this point, the release will be tracked historically using the Git tag, so there is no reason to keep the release branch once it has been merged. You may wish to delay the deletion for a few days in case it is needed for some reason, but when you are ready, the commands to delete the local and remote branches are:
423+
424+
> [!IMPORTANT]
425+
> Release branches start with `release\v`. Take care not to delete the tag, which starts with a `v`.
426+
427+
```console
428+
git branch -d <release-branch>
429+
git push --delete <remote-name> <release-branch>
430+
```
431+
362432
### Update Lucene.NET
363433

364434
The Lucene.NET project is the only consumer of this package. If the release was intended for general use (not just a one-off scan), update the version in `Dependencies.props` to reflect the new release and submit a pull request to [the Lucene.NET repository](https://github.com/apache/lucenenet).

0 commit comments

Comments
 (0)