xref: /aosp_15_r20/external/grpc-grpc-java/RELEASING.md (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1*e07d83d3SAndroid Build Coastguard WorkerHow to Create a Release of GRPC Java (for Maintainers Only)
2*e07d83d3SAndroid Build Coastguard Worker===============================================================
3*e07d83d3SAndroid Build Coastguard Worker
4*e07d83d3SAndroid Build Coastguard WorkerBuild Environments
5*e07d83d3SAndroid Build Coastguard Worker------------------
6*e07d83d3SAndroid Build Coastguard WorkerWe deploy GRPC to Maven Central under the following systems:
7*e07d83d3SAndroid Build Coastguard Worker- Ubuntu 14.04 with Docker 13.03.0 that runs CentOS 7
8*e07d83d3SAndroid Build Coastguard Worker- Windows 7 64-bit with Visual Studio
9*e07d83d3SAndroid Build Coastguard Worker- Mac OS X 10.14.6
10*e07d83d3SAndroid Build Coastguard Worker
11*e07d83d3SAndroid Build Coastguard WorkerOther systems may also work, but we haven't verified them.
12*e07d83d3SAndroid Build Coastguard Worker
13*e07d83d3SAndroid Build Coastguard WorkerCommon Variables
14*e07d83d3SAndroid Build Coastguard Worker----------------
15*e07d83d3SAndroid Build Coastguard WorkerMany of the following commands expect release-specific variables to be set. Set
16*e07d83d3SAndroid Build Coastguard Workerthem before continuing, and set them again when resuming.
17*e07d83d3SAndroid Build Coastguard Worker
18*e07d83d3SAndroid Build Coastguard Worker```bash
19*e07d83d3SAndroid Build Coastguard Worker$ MAJOR=1 MINOR=7 PATCH=0 # Set appropriately for new release
20*e07d83d3SAndroid Build Coastguard Worker$ VERSION_FILES=(
21*e07d83d3SAndroid Build Coastguard Worker  build.gradle
22*e07d83d3SAndroid Build Coastguard Worker  core/src/main/java/io/grpc/internal/GrpcUtil.java
23*e07d83d3SAndroid Build Coastguard Worker  examples/build.gradle
24*e07d83d3SAndroid Build Coastguard Worker  examples/pom.xml
25*e07d83d3SAndroid Build Coastguard Worker  examples/android/clientcache/app/build.gradle
26*e07d83d3SAndroid Build Coastguard Worker  examples/android/helloworld/app/build.gradle
27*e07d83d3SAndroid Build Coastguard Worker  examples/android/routeguide/app/build.gradle
28*e07d83d3SAndroid Build Coastguard Worker  examples/android/strictmode/app/build.gradle
29*e07d83d3SAndroid Build Coastguard Worker  examples/example-*/build.gradle
30*e07d83d3SAndroid Build Coastguard Worker  examples/example-*/pom.xml
31*e07d83d3SAndroid Build Coastguard Worker  )
32*e07d83d3SAndroid Build Coastguard Worker```
33*e07d83d3SAndroid Build Coastguard Worker
34*e07d83d3SAndroid Build Coastguard Worker
35*e07d83d3SAndroid Build Coastguard WorkerBranching the Release
36*e07d83d3SAndroid Build Coastguard Worker---------------------
37*e07d83d3SAndroid Build Coastguard WorkerThe first step in the release process is to create a release branch and bump
38*e07d83d3SAndroid Build Coastguard Workerthe SNAPSHOT version. Our release branches follow the naming
39*e07d83d3SAndroid Build Coastguard Workerconvention of `v<major>.<minor>.x`, while the tags include the patch version
40*e07d83d3SAndroid Build Coastguard Worker`v<major>.<minor>.<patch>`. For example, the same branch `v1.7.x`
41*e07d83d3SAndroid Build Coastguard Workerwould be used to create all `v1.7` tags (e.g. `v1.7.0`, `v1.7.1`).
42*e07d83d3SAndroid Build Coastguard Worker
43*e07d83d3SAndroid Build Coastguard Worker1. Review the issues in the current release [milestone](https://github.com/grpc/grpc-java/milestones)
44*e07d83d3SAndroid Build Coastguard Worker   for issues that won't make the cut. Check if any of them can be
45*e07d83d3SAndroid Build Coastguard Worker   closed. Be aware of the issues with the [TODO:release blocker][] label.
46*e07d83d3SAndroid Build Coastguard Worker   Consider reaching out to the assignee for the status update.
47*e07d83d3SAndroid Build Coastguard Worker2. For `master`, change root build files to the next minor snapshot (e.g.
48*e07d83d3SAndroid Build Coastguard Worker   ``1.8.0-SNAPSHOT``).
49*e07d83d3SAndroid Build Coastguard Worker
50*e07d83d3SAndroid Build Coastguard Worker   ```bash
51*e07d83d3SAndroid Build Coastguard Worker   $ git checkout -b bump-version master
52*e07d83d3SAndroid Build Coastguard Worker   # Change version to next minor (and keep -SNAPSHOT)
53*e07d83d3SAndroid Build Coastguard Worker   $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_GRPC_VERSION\)/'$MAJOR.$((MINOR+1)).0'\1/' \
54*e07d83d3SAndroid Build Coastguard Worker     "${VERSION_FILES[@]}"
55*e07d83d3SAndroid Build Coastguard Worker   $ sed -i s/$MAJOR.$MINOR.$PATCH/$MAJOR.$((MINOR+1)).0/ \
56*e07d83d3SAndroid Build Coastguard Worker     compiler/src/test{,Lite}/golden/Test{,Deprecated}Service.java.txt
57*e07d83d3SAndroid Build Coastguard Worker   $ ./gradlew build
58*e07d83d3SAndroid Build Coastguard Worker   $ git commit -a -m "Start $MAJOR.$((MINOR+1)).0 development cycle"
59*e07d83d3SAndroid Build Coastguard Worker   ```
60*e07d83d3SAndroid Build Coastguard Worker3. Go through PR review and submit.
61*e07d83d3SAndroid Build Coastguard Worker4. Create the release branch starting just before your commit and push it to GitHub:
62*e07d83d3SAndroid Build Coastguard Worker
63*e07d83d3SAndroid Build Coastguard Worker   ```bash
64*e07d83d3SAndroid Build Coastguard Worker   $ git fetch upstream
65*e07d83d3SAndroid Build Coastguard Worker   $ git checkout -b v$MAJOR.$MINOR.x \
66*e07d83d3SAndroid Build Coastguard Worker     $(git log --pretty=format:%H --grep "^Start $MAJOR.$((MINOR+1)).0 development cycle$" upstream/master)^
67*e07d83d3SAndroid Build Coastguard Worker   $ git push upstream v$MAJOR.$MINOR.x
68*e07d83d3SAndroid Build Coastguard Worker   ```
69*e07d83d3SAndroid Build Coastguard Worker5. Continue with Google-internal steps at go/grpc/java/releasing, but stop
70*e07d83d3SAndroid Build Coastguard Worker   before `Auto releasing using kokoro`.
71*e07d83d3SAndroid Build Coastguard Worker6. Create a milestone for the next release.
72*e07d83d3SAndroid Build Coastguard Worker7. Move items out of the release milestone that didn't make the cut. Issues that
73*e07d83d3SAndroid Build Coastguard Worker   may be backported should stay in the release milestone. Treat issues with the
74*e07d83d3SAndroid Build Coastguard Worker   'release blocker' label with special care.
75*e07d83d3SAndroid Build Coastguard Worker8. Begin compiling release notes. This produces a starting point:
76*e07d83d3SAndroid Build Coastguard Worker
77*e07d83d3SAndroid Build Coastguard Worker   ```bash
78*e07d83d3SAndroid Build Coastguard Worker   $ echo "## gRPC Java $MAJOR.$MINOR.0 Release Notes" && echo && \
79*e07d83d3SAndroid Build Coastguard Worker     git shortlog "$(git merge-base upstream/v$MAJOR.$((MINOR-1)).x upstream/v$MAJOR.$MINOR.x)"..upstream/v$MAJOR.$MINOR.x | cat && \
80*e07d83d3SAndroid Build Coastguard Worker     echo && echo && echo "Backported commits in previous release:" && \
81*e07d83d3SAndroid Build Coastguard Worker     git log --oneline "$(git merge-base v$MAJOR.$((MINOR-1)).0 upstream/v$MAJOR.$MINOR.x)"..v$MAJOR.$((MINOR-1)).0^
82*e07d83d3SAndroid Build Coastguard Worker   ```
83*e07d83d3SAndroid Build Coastguard Worker
84*e07d83d3SAndroid Build Coastguard Worker[TODO:release blocker]: https://github.com/grpc/grpc-java/issues?q=label%3A%22TODO%3Arelease+blocker%22
85*e07d83d3SAndroid Build Coastguard Worker[TODO:backport]: https://github.com/grpc/grpc-java/issues?q=label%3ATODO%3Abackport
86*e07d83d3SAndroid Build Coastguard Worker
87*e07d83d3SAndroid Build Coastguard WorkerTagging the Release
88*e07d83d3SAndroid Build Coastguard Worker-------------------
89*e07d83d3SAndroid Build Coastguard Worker
90*e07d83d3SAndroid Build Coastguard Worker1. Verify there are no open issues in the release milestone. Open issues should
91*e07d83d3SAndroid Build Coastguard Worker   either be deferred or resolved and the fix backported. Verify there are no
92*e07d83d3SAndroid Build Coastguard Worker   [TODO:release blocker][] nor [TODO:backport][] issues (open or closed), or
93*e07d83d3SAndroid Build Coastguard Worker   that they are tracking an issue for a different branch.
94*e07d83d3SAndroid Build Coastguard Worker2. Ensure that Google-internal steps completed at go/grpc/java/releasing#before-tagging-a-release.
95*e07d83d3SAndroid Build Coastguard Worker3. For vMajor.Minor.x branch, change `README.md` to refer to the next release
96*e07d83d3SAndroid Build Coastguard Worker   version. _Also_ update the version numbers for protoc if the protobuf library
97*e07d83d3SAndroid Build Coastguard Worker   version was updated since the last release.
98*e07d83d3SAndroid Build Coastguard Worker
99*e07d83d3SAndroid Build Coastguard Worker   ```bash
100*e07d83d3SAndroid Build Coastguard Worker   $ git checkout v$MAJOR.$MINOR.x
101*e07d83d3SAndroid Build Coastguard Worker   $ git pull upstream v$MAJOR.$MINOR.x
102*e07d83d3SAndroid Build Coastguard Worker   $ git checkout -b release-v$MAJOR.$MINOR.$PATCH
103*e07d83d3SAndroid Build Coastguard Worker
104*e07d83d3SAndroid Build Coastguard Worker   # Bump documented gRPC versions.
105*e07d83d3SAndroid Build Coastguard Worker   # Also update protoc version to match protobuf version in gradle/libs.versions.toml.
106*e07d83d3SAndroid Build Coastguard Worker   $ ${EDITOR:-nano -w} README.md
107*e07d83d3SAndroid Build Coastguard Worker
108*e07d83d3SAndroid Build Coastguard Worker   $ git commit -a -m "Update README etc to reference $MAJOR.$MINOR.$PATCH"
109*e07d83d3SAndroid Build Coastguard Worker   ```
110*e07d83d3SAndroid Build Coastguard Worker4. Change root build files to remove "-SNAPSHOT" for the next release version
111*e07d83d3SAndroid Build Coastguard Worker   (e.g. `0.7.0`). Commit the result and make a tag:
112*e07d83d3SAndroid Build Coastguard Worker
113*e07d83d3SAndroid Build Coastguard Worker   ```bash
114*e07d83d3SAndroid Build Coastguard Worker   # Change version to remove -SNAPSHOT
115*e07d83d3SAndroid Build Coastguard Worker   $ sed -i 's/-SNAPSHOT\(.*CURRENT_GRPC_VERSION\)/\1/' "${VERSION_FILES[@]}"
116*e07d83d3SAndroid Build Coastguard Worker   $ sed -i s/-SNAPSHOT// compiler/src/test{,Lite}/golden/Test{,Deprecated}Service.java.txt
117*e07d83d3SAndroid Build Coastguard Worker   $ ./gradlew build
118*e07d83d3SAndroid Build Coastguard Worker   $ git commit -a -m "Bump version to $MAJOR.$MINOR.$PATCH"
119*e07d83d3SAndroid Build Coastguard Worker   $ git tag -a v$MAJOR.$MINOR.$PATCH -m "Version $MAJOR.$MINOR.$PATCH"
120*e07d83d3SAndroid Build Coastguard Worker   ```
121*e07d83d3SAndroid Build Coastguard Worker5. Change root build files to the next snapshot version (e.g. `0.7.1-SNAPSHOT`).
122*e07d83d3SAndroid Build Coastguard Worker   Commit the result:
123*e07d83d3SAndroid Build Coastguard Worker
124*e07d83d3SAndroid Build Coastguard Worker   ```bash
125*e07d83d3SAndroid Build Coastguard Worker   # Change version to next patch and add -SNAPSHOT
126*e07d83d3SAndroid Build Coastguard Worker   $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_GRPC_VERSION\)/'$MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT'\1/' \
127*e07d83d3SAndroid Build Coastguard Worker     "${VERSION_FILES[@]}"
128*e07d83d3SAndroid Build Coastguard Worker   $ sed -i s/$MAJOR.$MINOR.$PATCH/$MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT/ \
129*e07d83d3SAndroid Build Coastguard Worker     compiler/src/test{,Lite}/golden/Test{,Deprecated}Service.java.txt
130*e07d83d3SAndroid Build Coastguard Worker   $ ./gradlew build
131*e07d83d3SAndroid Build Coastguard Worker   $ git commit -a -m "Bump version to $MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT"
132*e07d83d3SAndroid Build Coastguard Worker   ```
133*e07d83d3SAndroid Build Coastguard Worker6. Go through PR review and push the release tag and updated release branch to
134*e07d83d3SAndroid Build Coastguard Worker   GitHub (DO NOT click the merge button on the GitHub page):
135*e07d83d3SAndroid Build Coastguard Worker
136*e07d83d3SAndroid Build Coastguard Worker   ```bash
137*e07d83d3SAndroid Build Coastguard Worker   $ git checkout v$MAJOR.$MINOR.x
138*e07d83d3SAndroid Build Coastguard Worker   $ git merge --ff-only release-v$MAJOR.$MINOR.$PATCH
139*e07d83d3SAndroid Build Coastguard Worker   $ git push upstream v$MAJOR.$MINOR.x
140*e07d83d3SAndroid Build Coastguard Worker   $ git push upstream v$MAJOR.$MINOR.$PATCH
141*e07d83d3SAndroid Build Coastguard Worker   ```
142*e07d83d3SAndroid Build Coastguard Worker7. Close the release milestone.
143*e07d83d3SAndroid Build Coastguard Worker
144*e07d83d3SAndroid Build Coastguard WorkerBuild Artifacts
145*e07d83d3SAndroid Build Coastguard Worker---------------
146*e07d83d3SAndroid Build Coastguard Worker
147*e07d83d3SAndroid Build Coastguard WorkerTrigger build as described in "Auto releasing using kokoro" at
148*e07d83d3SAndroid Build Coastguard Workergo/grpc/java/releasing.
149*e07d83d3SAndroid Build Coastguard Worker
150*e07d83d3SAndroid Build Coastguard WorkerIt runs three jobs on Kokoro, one on each platform. See their scripts:
151*e07d83d3SAndroid Build Coastguard Worker`linux_artifacts.sh`, `windows.bat`, and `unix.sh` (called directly for OS X;
152*e07d83d3SAndroid Build Coastguard Workercalled within the Docker environment on Linux). The mvn-artifacts/ outputs of
153*e07d83d3SAndroid Build Coastguard Workereach script is combined into a single folder and then processed by
154*e07d83d3SAndroid Build Coastguard Worker`upload_artifacts.sh`, which signs the files and uploads to Sonatype.
155*e07d83d3SAndroid Build Coastguard Worker
156*e07d83d3SAndroid Build Coastguard WorkerReleasing on Maven Central
157*e07d83d3SAndroid Build Coastguard Worker--------------------------
158*e07d83d3SAndroid Build Coastguard Worker
159*e07d83d3SAndroid Build Coastguard WorkerOnce all of the artifacts have been pushed to the staging repository, the
160*e07d83d3SAndroid Build Coastguard Workerrepository should have been closed by `upload_artifacts.sh`. Closing triggers
161*e07d83d3SAndroid Build Coastguard Workerseveral sanity checks on the repository. If this completes successfully, the
162*e07d83d3SAndroid Build Coastguard Workerrepository can then be `released`, which will begin the process of pushing the
163*e07d83d3SAndroid Build Coastguard Workernew artifacts to Maven Central (the staging repository will be destroyed in the
164*e07d83d3SAndroid Build Coastguard Workerprocess). You can see the complete process for releasing to Maven Central on the
165*e07d83d3SAndroid Build Coastguard Worker[OSSRH site](https://central.sonatype.org/pages/releasing-the-deployment.html).
166*e07d83d3SAndroid Build Coastguard Worker
167*e07d83d3SAndroid Build Coastguard WorkerBuild interop container image
168*e07d83d3SAndroid Build Coastguard Worker-----------------------------
169*e07d83d3SAndroid Build Coastguard Worker
170*e07d83d3SAndroid Build Coastguard WorkerWe have containers for each release to detect compatibility regressions with old
171*e07d83d3SAndroid Build Coastguard Workerreleases. Generate one for the new release by following the
172*e07d83d3SAndroid Build Coastguard Worker[GCR image generation instructions](https://github.com/grpc/grpc/blob/master/tools/interop_matrix/README.md#step-by-step-instructions-for-adding-a-gcr-image-for-a-new-release-for-compatibility-test).
173*e07d83d3SAndroid Build Coastguard Worker
174*e07d83d3SAndroid Build Coastguard WorkerUpdate README.md
175*e07d83d3SAndroid Build Coastguard Worker----------------
176*e07d83d3SAndroid Build Coastguard WorkerAfter waiting ~1 day and verifying that the release appears on [Maven
177*e07d83d3SAndroid Build Coastguard WorkerCentral](https://search.maven.org/search?q=g:io.grpc), cherry-pick the commit
178*e07d83d3SAndroid Build Coastguard Workerthat updated the README into the master branch.
179*e07d83d3SAndroid Build Coastguard Worker
180*e07d83d3SAndroid Build Coastguard Worker```bash
181*e07d83d3SAndroid Build Coastguard Worker$ git checkout -b bump-readme master
182*e07d83d3SAndroid Build Coastguard Worker$ git cherry-pick v$MAJOR.$MINOR.$PATCH^
183*e07d83d3SAndroid Build Coastguard Worker$ git push --set-upstream origin bump-readme
184*e07d83d3SAndroid Build Coastguard Worker```
185*e07d83d3SAndroid Build Coastguard Worker
186*e07d83d3SAndroid Build Coastguard WorkerNOTE: If you add to your ~/.gitconfig the following, you don't need the
187*e07d83d3SAndroid Build Coastguard Worker`--set-upstream`
188*e07d83d3SAndroid Build Coastguard Worker
189*e07d83d3SAndroid Build Coastguard Worker```text
190*e07d83d3SAndroid Build Coastguard Worker[push]
191*e07d83d3SAndroid Build Coastguard Worker	autoSetupRemote = true
192*e07d83d3SAndroid Build Coastguard Worker```
193*e07d83d3SAndroid Build Coastguard Worker
194*e07d83d3SAndroid Build Coastguard WorkerCreate a PR and go through the review process
195*e07d83d3SAndroid Build Coastguard Worker
196*e07d83d3SAndroid Build Coastguard WorkerUpdate version referenced by tutorials
197*e07d83d3SAndroid Build Coastguard Worker--------------------------------------
198*e07d83d3SAndroid Build Coastguard Worker
199*e07d83d3SAndroid Build Coastguard WorkerUpdate `params.grpc_vers.java` in
200*e07d83d3SAndroid Build Coastguard Worker[config.yaml](https://github.com/grpc/grpc.io/blob/master/config.yaml)
201*e07d83d3SAndroid Build Coastguard Workerof the grpc.io repository.
202*e07d83d3SAndroid Build Coastguard Worker
203*e07d83d3SAndroid Build Coastguard WorkerNotify the Community
204*e07d83d3SAndroid Build Coastguard Worker--------------------
205*e07d83d3SAndroid Build Coastguard WorkerFinally, document and publicize the release.
206*e07d83d3SAndroid Build Coastguard Worker
207*e07d83d3SAndroid Build Coastguard Worker1. Add [Release Notes](https://github.com/grpc/grpc-java/releases) for the new tag.
208*e07d83d3SAndroid Build Coastguard Worker   The description should include any major fixes or features since the last release.
209*e07d83d3SAndroid Build Coastguard Worker   You may choose to add links to bugs, PRs, or commits if appropriate.
210*e07d83d3SAndroid Build Coastguard Worker2. Post a release announcement to [grpc-io](https://groups.google.com/forum/#!forum/grpc-io)
211*e07d83d3SAndroid Build Coastguard Worker   (`[email protected]`). The title should be something that clearly identifies
212*e07d83d3SAndroid Build Coastguard Worker   the release (e.g.`GRPC-Java <tag> Released`).
213*e07d83d3SAndroid Build Coastguard Worker   - Note that there may have been backports to the release branch since you
214*e07d83d3SAndroid Build Coastguard Worker     generated the release notes. Please verify that any backports are reflected
215*e07d83d3SAndroid Build Coastguard Worker     in the release notes before sending them out.
216*e07d83d3SAndroid Build Coastguard Worker
217*e07d83d3SAndroid Build Coastguard WorkerUpdate Hosted Javadoc
218*e07d83d3SAndroid Build Coastguard Worker---------------------
219*e07d83d3SAndroid Build Coastguard Worker
220*e07d83d3SAndroid Build Coastguard WorkerNow we need to update gh-pages with the new Javadoc:
221*e07d83d3SAndroid Build Coastguard Worker
222*e07d83d3SAndroid Build Coastguard Worker```bash
223*e07d83d3SAndroid Build Coastguard Workergit checkout gh-pages
224*e07d83d3SAndroid Build Coastguard Workergit pull --ff-only upstream gh-pages
225*e07d83d3SAndroid Build Coastguard Workerrm -r javadoc/
226*e07d83d3SAndroid Build Coastguard Workerwget -O grpc-all-javadoc.jar "http://search.maven.org/remotecontent?filepath=io/grpc/grpc-all/$MAJOR.$MINOR.$PATCH/grpc-all-$MAJOR.$MINOR.$PATCH-javadoc.jar"
227*e07d83d3SAndroid Build Coastguard Workerunzip -d javadoc grpc-all-javadoc.jar
228*e07d83d3SAndroid Build Coastguard Workerpatch -p1 < ga.patch
229*e07d83d3SAndroid Build Coastguard Workerrm grpc-all-javadoc.jar
230*e07d83d3SAndroid Build Coastguard Workerrm -r javadoc/META-INF/
231*e07d83d3SAndroid Build Coastguard Workergit add -A javadoc
232*e07d83d3SAndroid Build Coastguard Workergit commit -m "Javadoc for $MAJOR.$MINOR.$PATCH"
233*e07d83d3SAndroid Build Coastguard Worker```
234*e07d83d3SAndroid Build Coastguard Worker
235*e07d83d3SAndroid Build Coastguard WorkerPush gh-pages to the main repository and verify the current version is [live
236*e07d83d3SAndroid Build Coastguard Workeron grpc.io](https://grpc.io/grpc-java/javadoc/).
237