Skip to content

Commit 113aaf1

Browse files
committed
docs: create new document describing proposed release/branch management
In this PR, we aim to create a central document that describes how we want to drive the release process, as well as branch management going forward.
1 parent 096ab65 commit 113aaf1

File tree

1 file changed

+340
-0
lines changed

1 file changed

+340
-0
lines changed

docs/release_branch_management.md

Lines changed: 340 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
# Release Branch Management
2+
3+
## Overview
4+
5+
This document describes the branch management workflow for lnd releases. The
6+
master branch remains open for merges at all times. Release stabilization
7+
happens on dedicated release branches, with CI automation handling backports of
8+
milestone-tagged changes. This approach maintains continuous development
9+
velocity while ensuring stable releases.
10+
11+
## Branch Model Principles
12+
13+
The release process operates on four core principles:
14+
15+
**Master is always open.** Developers merge approved pull requests at any time
16+
without coordination around release windows. No merge freezes occur.
17+
18+
**Each major release gets a dedicated branch.** When cutting a new major
19+
version, create a release branch from master. This branch handles all release
20+
candidates and subsequent patch releases for that version series.
21+
22+
**CI automation handles backports.** Pull requests merged to master and tagged
23+
with a release milestone are automatically backported to the corresponding
24+
release branch. The automation creates backport PRs when conflicts occur.
25+
26+
**Changes flow one direction only.** Changes move from master to release
27+
branches, never in reverse. Master always represents the latest development
28+
state.
29+
30+
## Master Branch
31+
32+
The master branch contains ongoing development work for future releases. It
33+
never freezes for releases.
34+
35+
### Master Version Convention
36+
37+
Master uses a `.99` patch version to indicate unreleased development work. After
38+
creating the `v0.21.x-branch` branch, update master's version in
39+
`build/version.go` to `0.21.99-beta`. This clearly signals post-0.21 but
40+
pre-0.22 code.
41+
42+
When creating the next release branch (`v0.22.x-branch`), update master to
43+
`0.22.99-beta`. This pattern sorts correctly and is immediately recognizable as
44+
a development build.
45+
46+
### Merging to Master
47+
48+
Developers merge to master following normal review processes. If a change should
49+
be included in an active or upcoming release, tag the pull request with the
50+
appropriate milestone (`v0.21.0`, `v0.21.1`, etc.). The CI automation handles
51+
backporting after merge.
52+
53+
No special coordination is required. Merge whenever the PR is approved,
54+
regardless of ongoing release activities. Initially manual input may be required
55+
to resolve conflicts that may arise. In the future LLM bots can help alleviate
56+
this manual work.
57+
58+
## Major Release Process
59+
60+
A major release introduces new features and represents a new minor version
61+
(e.g., 0.21.0, 0.22.0).
62+
63+
### Creating the Release Branch
64+
65+
When ready to begin a major release:
66+
67+
1. Create a release branch from master: `git checkout -b v0.21.x-branch master`
68+
2. Push the branch: `git push origin v0.21.x-branch`
69+
3. Update `build/version.go` on the release branch to `0.21.0-beta.rc1`
70+
4. Commit the version bump: `git commit -am "build: bump version to v0.21.0-beta.rc1"`
71+
5. Update master's version to `0.21.99-beta` via a pull request
72+
6. Configure branch protection for `v0.21.x-branch` on GitHub
73+
74+
### Release Candidate Cycle
75+
76+
Create the first release candidate by tagging the version bump commit:
77+
78+
```bash
79+
git tag -s v0.21.0-beta.rc1 -m "lnd v0.21.0-beta.rc1"
80+
git push origin v0.21.0-beta.rc1
81+
```
82+
83+
This triggers CI to build release artifacts and Docker images.
84+
85+
As testing uncovers issues, develop fixes on master and tag them with the
86+
`v0.21.0` milestone. Once merged, CI automation backports them to
87+
`v0.21.x-branch`. If backports apply cleanly, they merge automatically. If
88+
conflicts occur, CI creates backport PRs for manual resolution.
89+
90+
When ready for the next release candidate:
91+
92+
1. Create a pull request against the release branch to update `build/version.go` to `0.21.0-beta.rc2`
93+
2. After merging the PR, tag the merge commit on the release branch: `git tag -s v0.21.0-beta.rc2 -m "lnd v0.21.0-beta.rc2"`
94+
3. Push the new tag: `git push origin v0.21.0-beta.rc2`
95+
96+
Repeat this cycle (rc3, rc4, etc.) until the release is stable.
97+
98+
### Final Release
99+
100+
For the final release, remove the RC suffix:
101+
102+
1. Create a pull request against the release branch to update `build/version.go` to `0.21.0-beta`
103+
2. After merging the PR, tag the merge commit on the release branch: `git tag -s v0.21.0-beta -m "lnd v0.21.0-beta"`
104+
3. Push the new tag: `git push origin v0.21.0-beta`
105+
106+
The `v0.21.x-branch` branch now enters maintenance mode for future patch
107+
releases.
108+
109+
## Minor Release Process
110+
111+
Minor (patch) releases fix bugs or security issues in released versions. They
112+
reuse the existing release branch for that version series.
113+
114+
### Creating a Patch Release
115+
116+
When a critical fix is needed for version 0.21.0:
117+
118+
1. Develop and merge the fix to master
119+
2. Tag the PR with the `v0.21.1` milestone
120+
3. CI automation backports to `v0.21.x-branch`
121+
4. Create a pull request against the release branch to update `build/version.go` to `0.21.1-beta.rc1`
122+
5. After merging the PR, tag the merge commit: `git tag -s v0.21.1-beta.rc1 -m "lnd v0.21.1-beta.rc1"`
123+
6. Push the new tag: `git push origin v0.21.1-beta.rc1`
124+
125+
If additional fixes are needed, follow the same process, incrementing through
126+
rc2, rc3, etc.
127+
128+
For the final patch release:
129+
130+
1. Create a pull request against the release branch to update `build/version.go` to `0.21.1-beta`
131+
2. After merging the PR, tag the merge commit: `git tag -s v0.21.1-beta -m "lnd v0.21.1-beta"`
132+
3. Push the new tag: `git push origin v0.21.1-beta`
133+
134+
Multiple patch releases (0.21.1, 0.21.2, 0.21.3) can be created on the same
135+
`v0.21.x-branch` branch throughout the version's lifetime.
136+
137+
## Manual Cherry-Picking
138+
139+
Occasionally, a fix may be needed on a release branch that doesn't apply to
140+
master (release-specific issues, backports to older versions where master has
141+
diverged significantly, etc.).
142+
143+
### When to Cherry-Pick Manually
144+
145+
Cherry-pick directly to a release branch when:
146+
147+
- The issue only exists on the release branch, not on master
148+
- Master's code has changed significantly, making a direct backport impractical
149+
- An urgent hotfix is needed before CI automation completes
150+
151+
### Cherry-Pick Process
152+
153+
```bash
154+
# Switch to the release branch
155+
git checkout v0.21.x-branch
156+
157+
# Cherry-pick the commit from master
158+
git cherry-pick <commit-hash>
159+
160+
# If conflicts occur, resolve them and continue
161+
git cherry-pick --continue
162+
```
163+
164+
Cherry-picks still follow the normal PR flow, so a PR should be made only into
165+
the target release branch for normal review and CI.
166+
167+
When manually cherry-picking, document why the normal backport flow was
168+
bypassed. If a corresponding change is needed on master (to prevent the bug from
169+
reappearing in future releases), ensure it's merged there as well.
170+
171+
## Pull Request Milestones
172+
173+
Developers use GitHub milestones to indicate which releases should include their
174+
changes.
175+
176+
### Assigning Milestones
177+
178+
When opening a PR, consider whether it should be backported to an active
179+
release:
180+
181+
- **Bug fixes for active releases:** Assign the major release milestone (e.g.,
182+
`v0.21.0`)
183+
184+
- **Critical fixes for older versions:** Assign the patch release milestone
185+
(e.g., `v0.20.3`)
186+
187+
- **Features for future releases only:** No milestone, or assign the next major
188+
release milestone
189+
190+
Milestones can be assigned at any time, even after merge. CI automation
191+
processes milestone-tagged PRs whenever they're detected.
192+
193+
### Multiple Milestones
194+
195+
If a fix needs to go into multiple release branches, assign multiple milestones
196+
to the PR. CI handles each backport independently. For example, a security fix
197+
might get both `v0.21.0` and `v0.20.3` milestones.
198+
199+
## Backport Automation
200+
201+
CI automation monitors merged PRs and backports milestone-tagged changes to the
202+
appropriate release branches. This section describes the automation's behavior.
203+
Implementation details are tracked in separate GitHub issues.
204+
205+
### Automatic Backports
206+
207+
When a PR with a release milestone merges to master:
208+
209+
1. CI detects the milestone and identifies the target release branch
210+
2. CI attempts a three-way merge onto the release branch
211+
3. If successful, CI commits directly with a reference to the original PR
212+
4. The backported change appears in the next release candidate
213+
214+
Developers don't need to take any action for successful backports.
215+
216+
### Conflict Resolution
217+
218+
When a backport conflicts:
219+
220+
1. CI creates a new PR against the release branch
221+
2. The PR contains the attempted backport with conflict markers
222+
3. CI assigns the PR to the original author and notifies via GitHub mentions
223+
4. The author or maintainers resolve conflicts and merge the backport PR
224+
225+
Backport PRs follow the normal review process and must pass all CI checks.
226+
227+
### Monitoring Backports
228+
229+
Track backport status through GitHub Projects or by filtering PRs. Backport PRs
230+
include labels indicating the original PR and milestone. Successfully backported
231+
commits reference the original PR in their commit messages.
232+
233+
## Version Bump Timing
234+
235+
Version numbers in `build/version.go` must be updated at specific points in the
236+
release process.
237+
238+
**On release branches:** Update immediately before tagging. The commit that
239+
updates the version is the commit that gets tagged. This ensures built binaries
240+
report the correct version.
241+
242+
**On master:** Update when creating a new release branch. Master moves from
243+
`0.20.99-beta` to `0.21.99-beta` when `v0.21-release` is created.
244+
245+
**For each RC:** Increment the RC number before tagging. `0.21.0-beta.rc1`
246+
`0.21.0-beta.rc2``0.21.0-beta.rc3`, etc.
247+
248+
**For final releases:** Remove the RC suffix. `0.21.0-beta.rc5``0.21.0-beta`.
249+
250+
## Branch Model Visualization
251+
252+
The following diagrams illustrate the branch workflow and change flow.
253+
254+
### Timeline View: Major Release Branch Lifecycle
255+
256+
```mermaid
257+
gitGraph
258+
commit id: "0.20.0 released"
259+
commit id: "Feature A"
260+
commit id: "Feature B"
261+
branch v0.21.x-branch
262+
commit id: "Version → 0.21.0-rc1" tag: "v0.21.0-beta.rc1"
263+
checkout main
264+
commit id: "Feature C (for 0.22)"
265+
commit id: "Feature D (for 0.22)"
266+
checkout v0.21.x-branch
267+
commit id: "Backport: Fix X"
268+
commit id: "Version → 0.21.0-rc2" tag: "v0.21.0-beta.rc2"
269+
checkout main
270+
commit id: "Feature E (for 0.22)"
271+
commit id: "Fix Y (backport to 0.21)"
272+
checkout v0.21.x-branch
273+
commit id: "Backport: Fix Y"
274+
commit id: "Version → 0.21.0" tag: "v0.21.0-beta"
275+
checkout main
276+
commit id: "Feature F (for 0.22)"
277+
commit id: "Feature G (for 0.22)"
278+
checkout v0.21.x-branch
279+
commit id: "Backport: Critical fix Z"
280+
commit id: "Version → 0.21.1-rc1" tag: "v0.21.1-beta.rc1"
281+
commit id: "Version → 0.21.1" tag: "v0.21.1-beta"
282+
checkout main
283+
commit id: "Continue development"
284+
```
285+
286+
After the v0.21.x-branch branch is created, both branches evolve independently.
287+
Master continues with features for future releases while the release branch
288+
focuses solely on stabilization and bug fixes.
289+
290+
### Pull Request Flow with Milestone-Based Backports
291+
292+
```mermaid
293+
flowchart TD
294+
A[PR Merged to Master] --> B{Has Release<br/>Milestone?}
295+
B -->|No| C[Done - Stays in Master Only]
296+
B -->|Yes| D{Release Branch<br/>Exists?}
297+
D -->|No| E[Queued for Future<br/>Release Branch]
298+
D -->|Yes| F{First RC<br/>Tagged?}
299+
F -->|No| G[Queued Until<br/>RC1 Tagged]
300+
F -->|Yes| H[CI: Attempt<br/>Backport]
301+
H --> I{Clean<br/>Apply?}
302+
I -->|Yes| J[Auto-merge to<br/>Release Branch]
303+
I -->|No| K[Create Backport PR<br/>for Manual Resolution]
304+
J --> L[Done]
305+
K --> M[Maintainer Resolves<br/>Conflicts]
306+
M --> L
307+
```
308+
309+
The milestone tag triggers the backport process. CI validates that the target
310+
release branch exists and has entered the RC phase before attempting backports.
311+
312+
### Major vs Minor Release Branching
313+
314+
```mermaid
315+
gitGraph
316+
commit id: "Development"
317+
commit id: "More work"
318+
branch v0.21.x-branch
319+
commit id: "v0.21.0-rc1" tag: "v0.21.0-beta.rc1"
320+
commit id: "v0.21.0-rc2" tag: "v0.21.0-beta.rc2"
321+
commit id: "v0.21.0 final" tag: "v0.21.0-beta"
322+
checkout main
323+
commit id: "Continue dev"
324+
commit id: "More features"
325+
checkout v0.21.x-branch
326+
commit id: "Patch fix 1"
327+
commit id: "v0.21.1" tag: "v0.21.1-beta"
328+
commit id: "Patch fix 2"
329+
commit id: "v0.21.2" tag: "v0.21.2-beta"
330+
checkout main
331+
commit id: "Keep developing"
332+
branch v0.22.x-branch
333+
commit id: "v0.22.0-rc1" tag: "v0.22.0-beta.rc1"
334+
checkout main
335+
commit id: "Future work"
336+
```
337+
338+
The v0.21.x-branch branch serves both the initial 0.21.0 release and subsequent
339+
patch releases (0.21.1, 0.21.2). When 0.22 development is ready, a new
340+
v0.22.x-branch branch is created, and the cycle repeats.

0 commit comments

Comments
 (0)