Skip to content

Commit 849cb1f

Browse files
authored
Update documentation to reflect new branching strategy (mongodb#2632)
1 parent 1af8b9d commit 849cb1f

File tree

2 files changed

+20
-83
lines changed

2 files changed

+20
-83
lines changed

RELEASING.md

+20-80
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Releasing
22

3-
The following steps outline the release process for both new minor versions (e.g.
4-
releasing the `master` branch as X.Y.0) and patch versions (e.g. releasing the
5-
`vX.Y` branch as X.Y.Z).
3+
The following steps outline the release process for both new minor versions and
4+
patch versions.
65

76
The command examples below assume that the canonical "mongodb" repository has
87
the remote name "mongodb". You may need to adjust these commands if you've given
@@ -37,26 +36,10 @@ page.
3736
This uses [semantic versioning](https://semver.org/). Do not break
3837
backwards compatibility in a non-major release or your users will kill you.
3938

40-
Before proceeding, ensure that the `master` branch is up-to-date with all code
39+
Before proceeding, ensure that the default branch is up-to-date with all code
4140
changes in this maintenance branch. This is important because we will later
42-
merge the ensuing release commits up to master with `--strategy=ours`, which
43-
will ignore changes from the merged commits.
44-
45-
## Update composer.json
46-
47-
This is especially important before releasing a new minor version.
48-
49-
Ensure that the extension and PHP library requirements, as well as the branch
50-
alias in `composer.json` are correct for the version being released. For
51-
example, the branch alias for the 4.1.0 release in the `master` branch should
52-
be `4.1.x-dev`.
53-
54-
Commit and push any changes:
55-
56-
```console
57-
$ git commit -m "Update composer.json X.Y.Z" composer.json
58-
$ git push mongodb
59-
```
41+
merge the ensuing release commits with `--strategy=ours`, which will ignore
42+
changes from the merged commits.
6043

6144
## Tag the release
6245

@@ -69,78 +52,35 @@ $ git push mongodb --tags
6952

7053
## Branch management
7154

72-
# Creating a maintenance branch and updating master branch alias
55+
# Creating a maintenance branch and updating default branch name
7356

74-
After releasing a new major or minor version (e.g. 4.0.0), a maintenance branch
75-
(e.g. v4.0) should be created. Any development towards a patch release (e.g.
76-
4.0.1) would then be done within that branch and any development for the next
77-
major or minor release can continue in master.
57+
When releasing a new major or minor version (e.g. 4.0.0), the default branch
58+
should be renamed to the next version (e.g. 4.1). Renaming the default branch
59+
using GitHub's UI ensures that all open pull request are changed to target the
60+
new version.
7861

79-
After creating a maintenance branch, the `extra.branch-alias.dev-master` field
80-
in the master branch's `composer.json` file should be updated. For example,
81-
after branching v4.0, `composer.json` in the master branch may still read:
82-
83-
```
84-
"branch-alias": {
85-
"dev-master": "4.0.x-dev"
86-
}
87-
```
88-
89-
The above would be changed to:
90-
91-
```
92-
"branch-alias": {
93-
"dev-master": "4.1.x-dev"
94-
}
95-
```
96-
97-
Commit this change:
98-
99-
```console
100-
$ git commit -m "Master is now 4.1-dev" composer.json
101-
```
102-
103-
### After releasing a new minor version
104-
105-
After a new minor version is released (i.e. `master` was tagged), a maintenance
106-
branch should be created for future patch releases:
107-
108-
```console
109-
$ git checkout -b vX.Y
110-
$ git push mongodb vX.Y
111-
```
112-
113-
Update the master branch alias in `composer.json`:
114-
115-
```diff
116-
"extra": {
117-
"branch-alias": {
118-
- "dev-master": "4.0.x-dev"
119-
+ "dev-master": "4.1.x-dev"
120-
}
121-
},
122-
```
123-
124-
Commit and push this change:
62+
Once the default branch has been renamed, create the maintenance branch for the
63+
version to be released (e.g. 4.0):
12564

12665
```console
127-
$ git commit -m "Master is now X.Y-dev" composer.json
128-
$ git push mongodb
66+
$ git checkout -b X.Y
67+
$ git push mongodb X.Y
12968
```
13069

13170
### After releasing a patch version
13271

133-
If this was a patch release, the maintenance branch must be merged up to master:
72+
If this was a patch release, the maintenance branch must be merged up to the
73+
default branch (e.g. 4.1):
13474

13575
```console
136-
$ git checkout master
137-
$ git pull mongodb master
138-
$ git merge vX.Y --strategy=ours
76+
$ git checkout 4.1
77+
$ git pull mongodb 4.1
78+
$ git merge 4.0 --strategy=ours
13979
$ git push mongodb
14080
```
14181

14282
The `--strategy=ours` option ensures that all changes from the merged commits
143-
will be ignored. This is OK because we previously ensured that the `master`
83+
will be ignored. This is OK because we previously ensured that the `4.1`
14484
branch was up-to-date with all code changes in this maintenance branch before
14585
tagging.
14686

composer.json

-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@
5050
}
5151
},
5252
"extra": {
53-
"branch-alias": {
54-
"dev-master": "4.0.x-dev"
55-
},
5653
"laravel": {
5754
"providers": [
5855
"MongoDB\\Laravel\\MongoDBServiceProvider",

0 commit comments

Comments
 (0)