11# How to Create a Release of OpenCensus C++ (for Maintainers Only)
22
3- ## Tagging the Release
4-
5- The first step in the release process is to create a release branch, bump
6- versions, and create a tag for the release. Our release branches follow the
3+ In this example, pretend branch ` master ` currently has
4+ [ ` OPENCENSUS_VERSION ` ] ( opencensus/common/version.h ) set to "0.1.0-dev" -- which
5+ means we are creating release ` v0.1.0 ` .
6+
7+ 1 . Create a new branch ` v0.1.x ` .
8+ 1 . Bump branch ` master ` to the next minor: ` "0.2.0-dev" ` .
9+ ([ example] ( https://github.com/census-instrumentation/opencensus-cpp/pull/271 ) )
10+ 1 . On branch ` v0.1.x ` : pin build dependencies.
11+ ([ example] ( https://github.com/census-instrumentation/opencensus-cpp/pull/273 ) )
12+ 1 . On branch ` v0.1.x ` : bump version to ` "0.1.0" ` (i.e. not ` -dev ` anymore)
13+ ([ example] ( https://github.com/census-instrumentation/opencensus-cpp/pull/274 ) )
14+ 1 . Create a release with tag ` v0.1.0 ` .
15+ ([ example] ( https://github.com/census-instrumentation/opencensus-cpp/releases/tag/v0.3.0 ) )
16+ 1 . On branch ` v0.1.x ` : bump version to ` "0.1.1-dev" ` (i.e. the next ` -dev ` )
17+ ([ example] ( https://github.com/census-instrumentation/opencensus-cpp/pull/275 ) )
18+
19+ ## Detailed instructions
20+
21+ Our release branches follow the
722naming convention of ` v<major>.<minor>.x ` , while the tags include the patch
823version ` v<major>.<minor>.<patch> ` . For example, the same branch ` v0.1.x ` would
924be used to create all ` v0.1 ` tags (e.g. ` v0.1.0 ` , ` v0.1.1 ` ).
1025
11- In this section upstream repository refers to the main opencensus-cpp github
12- repository.
26+ In this section, the remote called ` upstream ` refers to the official opencensus-cpp repository:
27+ ` git@github.com:census-instrumentation/opencensus-cpp.git `
28+
29+ The remote called ` origin ` refers to your fork, which you use to send PRs, e.g.:
30+ ` git@github.com:$USER/opencensus-cpp.git `
1331
14- Before any push to the upstream repository you need to create a [ personal access
32+ If you are using ` https ` instead of ` ssh ` as above,
33+ before any push to the upstream repository you need to create a [ personal access
1534token] ( https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ ) .
1635
17361 . Create the release branch and push it to GitHub:
@@ -21,73 +40,109 @@ token](https://help.github.com/articles/creating-a-personal-access-token-for-the
2140 $ VERSION_FILES=(
2241 opencensus/common/version.h
2342 )
24- $ git checkout -b v$MAJOR .$MINOR .x master
43+ $ git checkout -b v$MAJOR .$MINOR .x remotes/upstream/ master
2544 $ git push upstream v$MAJOR .$MINOR .x
2645 ```
2746
28- The branch will be automatically protected by the GitHub branch protection rule for release
29- branches.
30-
31- 2. For ` master` branch:
47+ The branch will be automatically protected by the GitHub branch protection
48+ rule for release branches.
3249
33- - Change version files to the next minor snapshot (e.g. ` 0.2.0-dev` ).
50+ 1. Bump branch ` master ` to the next minor version: ` 0.2.0-dev`
3451
3552 ` ` ` bash
36- $ git checkout -b bump-version master
53+ $ git checkout -b bump-version remotes/upstream/ master
3754 # Change version to next minor (and keep -dev)
3855 $ sed -i ' s/\(.*OPENCENSUS_VERSION.*\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1' $MAJOR .$(( MINOR+ 1 )) .0' /' \
3956 " ${VERSION_FILES[@]} "
4057 $ tools/presubmit.sh
41- $ git commit -a -m " Start $MAJOR .$(( MINOR+ 1 )) .0 development cycle"
58+ $ git commit -a -m " Start $MAJOR .$(( MINOR+ 1 )) .0 development cycle. "
4259 ` ` `
60+ Also bump the version in ` CMakeLists.txt` . Leave out the ` -dev` suffix
61+ because CMake doesn' t support it.
4362
44- - Go through PR review and push the master branch to GitHub :
63+ Push, then make a PR against the **` master`** branch:
4564
4665 ```bash
47- $ git checkout master
48- $ git merge --ff-only bump-version
49- $ git push upstream master
66+ $ git push origin bump-version
5067 ```
5168
52- 3. For ` vMajor.Minor.x` branch:
69+ 1. Switch to the release branch and pin BUILD dependencies.
70+
71+ ```bash
72+ $ git checkout -b deps remotes/upstream/v$MAJOR.$MINOR.x
73+ ```
74+
75+ One day, this will be automated. In the meantime, edit the `WORKSPACE` file
76+ and for every `http_archive`:
77+ * Use `git ls-remote https://github.com/abc/def master` to determine the
78+ commit.
79+ * Download the archive and `sha256sum` it.
80+ * Change `urls = ".../archive/master.zip"` to
81+ `urls = ".../archive/$COMMIT.zip`.
82+ * Change `strip_prefix` from `-master` to `-$COMMIT`.
83+ * Add `sha256 = "$SHASUM"`.
84+
85+ Likewise update the `cmake/*.CMakeLists.txt` files.
86+
87+ Run `tools/presubmit.sh` to test building with bazel, and follow the
88+ [CMake README](cmake/README.md) for CMake.
89+
90+ Push, then make a PR against the **`release`** branch, not the `master`
91+ branch: (important!)
92+
93+ ```bash
94+ $ git push origin deps
95+ ```
5396
54- - Change version files to remove " -dev" for the next release
55- version (e.g. ` 0.4.0` ). Commit the result and make a tag:
97+ 1. Bump the release branch to the release version. (remove `-dev`)
5698
5799 ```bash
58- $ git checkout -b release v$MAJOR .$MINOR .x
100+ $ git checkout -b release remotes/upstream/ v$MAJOR.$MINOR.x
59101 # Change version to remove -dev
60102 $ sed -i ' s/\( .* OPENCENSUS_VERSION.* [0-9]\+\. [0-9]\+\. [0-9]\+\) -dev/\1 /' \
61103 "${VERSION_FILES[@]}"
62104 $ tools/presubmit.sh
63- $ git commit -a -m " Bump version to $MAJOR .$MINOR .$PATCH "
64- $ git tag -a v$MAJOR .$MINOR .$PATCH -m " Version $MAJOR .$MINOR .$PATCH "
105+ $ git commit -a -m "Bump version to $MAJOR.$MINOR.$PATCH."
65106 ```
66107
67- - Change root build files to the next snapshot version (e.g.
68- ` 0.4.1-dev ` ). Commit the result:
108+ Push, then make a PR against the **`release`** branch, not the `master`
109+ branch: (important!)
69110
70111 ```bash
112+ $ git push origin release
113+ ```
114+
115+ 1. Create the release with tag `v0.1.0` using the branch `v0.1.x`
116+
117+ * Go to the [releases][RELEASE_LINK] page on GitHub.
118+ * Click "Draft a new release."
119+ * Set the "Tag version" to `v0.1.0`.
120+ * Set the "Target" to `v0.1.x`. (important!)
121+ * Set the "Release title" to "v0.1.0 Release."
122+ * Fill out the description with highlights.
123+ * Click "Publish release."
124+
125+ 1. Bump the release branch to the next `-dev` version.
126+
127+ ```bash
128+ $ git checkout -b release remotes/upstream/v$MAJOR.$MINOR.x
71129 # Change version to next patch and add -dev
72- $ sed -i ' s/\(.*OPENCENSUS_VERSION.*\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1' $MAJOR .$(( MINOR+ 1 )) .$(( PATCH+ 1 )) -dev' /' \
130+ $ sed -i ' s/\( .* OPENCENSUS_VERSION.* \) [0-9]\+\. [0-9]\+\. [0-9]\+ /\1 ' $MAJOR.$MINOR.$((PATCH+1))-dev' /' \
73131 "${VERSION_FILES[@]}"
74132 $ tools/presubmit.sh
75- $ git commit -a -m " Bump version to $MAJOR .$MINOR .$(( PATCH+ 1 )) -dev"
133+ $ git commit -a -m "Bump version to $MAJOR.$MINOR.$((PATCH+1))-dev. "
76134 ```
77135
78- - Go through PR review and push the release tag and updated release branch
79- to GitHub:
136+ Also bump the version in `CMakeLists.txt`. Leave out the `-dev` suffix
137+ because CMake doesn' t support it.
138+
139+ Push, then make a PR against the ** ` release` ** branch, not the ` master`
140+ branch: (important! )
80141
81142 ` ` ` bash
82- $ git checkout v$MAJOR .$MINOR .x
83- $ git merge --ff-only release
84- $ git push upstream v$MAJOR .$MINOR .$PATCH
85- $ git push upstream v$MAJOR .$MINOR .x
143+ $ git push origin release
86144 ` ` `
87145
88- 4. Write release notes
89- - Go to the [release page][RELEASE_LINK], draft a new release and publish
90- it after review.
91-
146+ 1. You' re done! `\o/`
92147
93148[RELEASE_LINK]: https://github.com/census-instrumentation/opencensus-cpp/releases
0 commit comments