|
| 1 | +# How to Create a Release of OpenCensus C++ (for Maintainers Only) |
| 2 | + |
| 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 |
| 7 | +naming convention of `v<major>.<minor>.x`, while the tags include the patch |
| 8 | +version `v<major>.<minor>.<patch>`. For example, the same branch `v0.1.x` would |
| 9 | +be used to create all `v0.1` tags (e.g. `v0.1.0`, `v0.1.1`). |
| 10 | + |
| 11 | +In this section upstream repository refers to the main opencensus-cpp github |
| 12 | +repository. |
| 13 | + |
| 14 | +Before any push to the upstream repository you need to create a [personal access |
| 15 | +token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/). |
| 16 | + |
| 17 | +1. Create the release branch and push it to GitHub: |
| 18 | + |
| 19 | + ```bash |
| 20 | + $ MAJOR=0 MINOR=1 PATCH=0 # Set appropriately for new release |
| 21 | + $ VERSION_FILES=( |
| 22 | + opencensus/common/version.h |
| 23 | + ) |
| 24 | + $ git checkout -b v$MAJOR.$MINOR.x master |
| 25 | + $ git push upstream v$MAJOR.$MINOR.x |
| 26 | + ``` |
| 27 | + |
| 28 | + The branch will be automatically protected by the GitHub branch protection rule for release |
| 29 | + branches. |
| 30 | + |
| 31 | +2. For `master` branch: |
| 32 | + |
| 33 | + - Change version files to the next minor snapshot (e.g. `0.2.0-dev`). |
| 34 | + |
| 35 | + ```bash |
| 36 | + $ git checkout -b bump-version master |
| 37 | + # Change version to next minor (and keep -dev) |
| 38 | + $ sed -i 's/\(.*OPENCENSUS_VERSION.*\)[0-9]\+\.[0-9]\+\.[0-9]\+/\1'$MAJOR.$((MINOR+1)).0'/' \ |
| 39 | + "${VERSION_FILES[@]}" |
| 40 | + $ tools/presubmit.sh |
| 41 | + $ git commit -a -m "Start $MAJOR.$((MINOR+1)).0 development cycle" |
| 42 | + ``` |
| 43 | + |
| 44 | + - Go through PR review and push the master branch to GitHub: |
| 45 | + |
| 46 | + ```bash |
| 47 | + $ git checkout master |
| 48 | + $ git merge --ff-only bump-version |
| 49 | + $ git push upstream master |
| 50 | + ``` |
| 51 | + |
| 52 | +3. For `vMajor.Minor.x` branch: |
| 53 | + |
| 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: |
| 56 | + |
| 57 | + ```bash |
| 58 | + $ git checkout -b release v$MAJOR.$MINOR.x |
| 59 | + # Change version to remove -dev |
| 60 | + $ sed -i 's/\(.*OPENCENSUS_VERSION.*[0-9]\+\.[0-9]\+\.[0-9]\+\)-dev/\1/' \ |
| 61 | + "${VERSION_FILES[@]}" |
| 62 | + $ 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" |
| 65 | + ``` |
| 66 | + |
| 67 | + - Change root build files to the next snapshot version (e.g. |
| 68 | + `0.4.1-dev`). Commit the result: |
| 69 | + |
| 70 | + ```bash |
| 71 | + # 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'/' \ |
| 73 | + "${VERSION_FILES[@]}" |
| 74 | + $ tools/presubmit.sh |
| 75 | + $ git commit -a -m "Bump version to $MAJOR.$MINOR.$((PATCH+1))-dev" |
| 76 | + ``` |
| 77 | + |
| 78 | + - Go through PR review and push the release tag and updated release branch |
| 79 | + to GitHub: |
| 80 | + |
| 81 | + ```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 |
| 86 | + ``` |
| 87 | + |
| 88 | +4. Write release notes |
| 89 | + - Go to the [release page][RELEASE_LINK], draft a new release and publish |
| 90 | + it after review. |
| 91 | + |
| 92 | + |
| 93 | +[RELEASE_LINK]: https://github.com/census-instrumentation/opencensus-cpp/releases |
0 commit comments