blob: 6a3f25f83b65d11b0881f8e51dc6073509ec662a [file] [log] [blame] [view]
nmittler483738e2015-06-08 14:32:37 -07001How to Create a Release of GRPC Java (for Maintainers Only)
2===============================================================
3
4Build Environments
5------------------
6We deploy GRPC to Maven Central under the following systems:
7- Ubuntu 14.04 with Docker 1.6.1 that runs CentOS 6.6
8- Windows 7 64-bit with MSYS2 with mingw32 and mingw64
9- Mac OS X 10.9.5
10
11Other systems may also work, but we haven't verified them.
12
13Prerequisites
14-------------
15
16### Setup OSSRH and Signing
17
18If you haven't deployed artifacts to Maven Central before, you need to setup
19your OSSRH (OSS Repository Hosting) account and signing keys.
20- Follow the instructions on [this
21 page](http://central.sonatype.org/pages/ossrh-guide.html) to set up an
22 account with OSSRH.
Carl Mastrangelo7a6b1662015-08-12 13:52:45 -070023 - You only need to create the account, not set up a new project
24 - Contact a gRPC maintainer to add your account after you have created it.
nmittler483738e2015-06-08 14:32:37 -070025- (For release deployment only) Install GnuPG and [generate your key
26 pair](https://www.gnupg.org/documentation/howtos.html). You'll also
27 need to [publish your public key](https://www.gnupg.org/gph/en/manual.html#AEN464)
28 to make it visible to the Sonatype servers
29 (e.g. `gpg --keyserver pgp.mit.edu --send-key <key ID>`).
30- Put your GnuPG key password and OSSRH account information in
31 `<your-home-directory>/.gradle/gradle.properties`.
32
33```
34# You need the signing properties only if you are making release deployment
35signing.keyId=<8-character-public-key-id>
36signing.password=<key-password>
37signing.secretKeyRingFile=<your-home-directory>/.gnupg/secring.gpg
38
39ossrhUsername=<ossrh-username>
40ossrhPassword=<ossrh-password>
41checkstyle.ignoreFailures=false
42```
43
44### Build Protobuf
45Protobuf libraries are needed for compiling the GRPC codegen. Despite that you
46may have installed Protobuf on your system, you may want to build Protobuf
47separately and install it under your personal directory, because
48
491. The Protobuf version installed on your system may be different from what
50 GRPC requires. You may not want to pollute your system installation.
512. We will deploy both 32-bit and 64-bit versions of the codegen, thus require
52 both variants of Protobuf libraries. You don't want to mix them in your
53 system paths.
54
55Please see the [Main Readme](README.md) for details on building protobuf.
56
57Tagging the Release
58----------------------
Eric Andersonb8245652016-02-17 11:34:50 -080059The first step in the release process is to create a release branch, bump
60versions, and create a tag for the release. Our release branches follow the naming
nmittler483738e2015-06-08 14:32:37 -070061convention of `v<major>.<minor>.x`, while the tags include the patch version
62`v<major>.<minor>.<patch>`. For example, the same branch `v0.7.x`
63would be used to create all `v0.7` tags (e.g. `v0.7.0`, `v0.7.1`).
64
Eric Andersonb8245652016-02-17 11:34:50 -0800651. Create the release branch and push it to GitHub:
nmittler483738e2015-06-08 14:32:37 -070066
67 ```bash
Eric Andersonb8245652016-02-17 11:34:50 -080068 $ MAJOR=0 MINOR=7 PATCH=0 # Set appropriately for new release
69 $ git checkout -b v$MAJOR.$MINOR.x master
70 $ git push upstream v$MAJOR.$MINOR.x
nmittler483738e2015-06-08 14:32:37 -070071 ```
Eric Andersonb8245652016-02-17 11:34:50 -0800722. For `master`, change `build.gradle` and
73 `android-interop-testing/app/build.gradle` to the next minor snapshot (e.g.
74 ``0.8.0-SNAPSHOT``).
nmittler483738e2015-06-08 14:32:37 -070075
76 ```bash
Eric Andersonb8245652016-02-17 11:34:50 -080077 $ git checkout -b bump-version master
78 # Change version to next minor (and keep -SNAPSHOT)
79 $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_GRPC_VERSION\)/'$MAJOR.$((MINOR+1)).0'\1/' \
Eric Anderson13f01222016-03-15 12:53:44 -070080 build.gradle android-interop-testing/app/build.gradle \
81 examples/android/app/build.gradle
Eric Andersonb8245652016-02-17 11:34:50 -080082 $ git commit -a -m "Start $MAJOR.$((MINOR+1)).0 development cycle"
nmittler483738e2015-06-08 14:32:37 -070083 ```
Eric Andersonb8245652016-02-17 11:34:50 -0800843. Go through PR review and push the master branch to GitHub:
nmittler483738e2015-06-08 14:32:37 -070085
86 ```bash
Eric Andersonb8245652016-02-17 11:34:50 -080087 $ git checkout master
88 $ git merge --ff-only bump-version
89 $ git push upstream master
nmittler483738e2015-06-08 14:32:37 -070090 ```
Eric Andersonb8245652016-02-17 11:34:50 -0800914. For vMajor.Minor.x branch, change `build.gradle` and
92 `android-interop-testing/app/build.gradle` to remove "-SNAPSHOT" for the next
93 release version (e.g. `0.7.0`). Commit the result and make a tag:
nmittler483738e2015-06-08 14:32:37 -070094
95 ```bash
Eric Andersonb8245652016-02-17 11:34:50 -080096 $ git checkout -b release v$MAJOR.$MINOR.x
97 # Change version to remove -SNAPSHOT
98 $ sed -i 's/-SNAPSHOT\(.*CURRENT_GRPC_VERSION\)/\1/' \
99 build.gradle android-interop-testing/app/build.gradle
100 $ git commit -a -m "Bump version to $MAJOR.$MINOR.$PATCH"
101 $ git tag -a v$MAJOR.$MINOR.$PATCH -m "Version $MAJOR.$MINOR.$PATCH"
nmittler483738e2015-06-08 14:32:37 -0700102 ```
Eric Andersonb8245652016-02-17 11:34:50 -08001035. Change `build.gradle` and `android-interop-testing/app/build.gradle` to the
104 next snapshot version (e.g. `0.7.1-SNAPSHOT`). Commit the result:
nmittler483738e2015-06-08 14:32:37 -0700105
106 ```bash
Eric Andersonb8245652016-02-17 11:34:50 -0800107 # Change version to next patch and add -SNAPSHOT
108 $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_GRPC_VERSION\)/'$MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT'\1/' \
109 build.gradle android-interop-testing/app/build.gradle
110 $ git commit -a -m "Bump version to $MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT"
111 ```
1126. Go through PR review and push the release tag and updated release branch to
113 GitHub:
114
115 ```bash
116 $ git checkout v$MAJOR.$MINOR.x
117 $ git merge --ff-only release
118 $ git push upstream v$MAJOR.$MINOR.$PATCH
119 $ git push upstream v$MAJOR.$MINOR.x
nmittler483738e2015-06-08 14:32:37 -0700120 ```
121
122Setup Build Environment
123---------------------------
124
125### Linux
126The deployment for Linux uses [Docker](https://www.docker.com/) running
127CentOS 6.6 in order to ensure that we have a consistent deployment environment
128on Linux. You'll first need to install Docker if not already installed on your
Carl Mastrangelo8f6562e2015-08-13 15:19:53 -0700129system. Make sure to have at least version 1.7.1 or later.
nmittler483738e2015-06-08 14:32:37 -0700130
1311. Under the [Protobuf source directory](https://github.com/google/protobuf),
132 build the `protoc-artifacts` image:
133
134 ```bash
135 protobuf$ docker build -t protoc-artifacts protoc-artifacts
136 ```
1372. Under the grpc-java source directory, build the `grpc-java-deploy` image:
138
139 ```bash
140 grpc-java$ docker build -t grpc-java-deploy compiler
141 ```
1423. Start a Docker container that has the deploy environment set up for you. The
143 GRPC source is cloned into `/grpc-java`.
144
145 ```bash
146 $ docker run -it --rm=true grpc-java-deploy
147 ```
148
149 Note that the container will be deleted after you exit. Any changes you have
150 made (e.g., copied configuration files) will be lost. If you want to keep the
151 container, remove `--rm=true` from the command line.
1524. Next, you'll need to copy your OSSRH credentials and GnuPG keys to your docker container.
Kun Zhang2bd08872016-01-22 15:32:04 -0800153 In Docker:
154 ```
155 # mkdir /root/.gradle
156 ```
157 Find the container ID in your bash prompt, which is shown as `[root@<container-ID> ...]`.
158 In host:
159 ```
160 $ docker cp ~/.gnupg <container-ID>:/root/
161 $ docker cp ~/.gradle/gradle.properties <container-ID>:/root/.gradle/
nmittler483738e2015-06-08 14:32:37 -0700162 ```
163
164 You'll also need to update `signing.secretKeyRingFile` in
165 `/root/.gradle/gradle.properties` to point to `/root/.gnupg/secring.gpg`.
166
167### Windows
168
169#### Windows 64-bit with MSYS2 (Recommended for Windows)
170Because the gcc shipped with MSYS2 doesn't support multilib, you have to
171compile and deploy 32-bit and 64-bit binaries in separate steps.
172
173##### Under MinGW-w64 Win32 Shell
1741. Compile and install 32-bit protobuf:
175
176 ```bash
177 protobuf$ ./configure --disable-shared --prefix=$HOME/protobuf-32
178 protobuf$ make clean && make && make install
179 ```
1802. Configure CXXFLAGS needed by the protoc plugin when building.
181
182 ```bash
183 grpc-java$ export CXXFLAGS="-I$HOME/protobuf-32/include" \
184 LDFLAGS="-L$HOME/protobuf-32/lib"
185 ```
186
187##### Under MinGW-w64 Win64 Shell
1881. Compile and install 64-bit protobuf:
189
190 ```bash
191 protobuf$ ./configure --disable-shared --prefix=$HOME/protobuf-64
192 protobuf$ make clean && make && make install
193 ```
1942. Configure CXXFLAGS needed by the protoc plugin when building.
195
196 ```bash
197 grpc-java$ export CXXFLAGS="-I$HOME/protobuf-64/include" \
198 LDFLAGS="-L$HOME/protobuf-64/lib"
199 ```
200
201#### Windows 64-bit with Cygwin64 (TODO: incomplete)
202Because the MinGW gcc shipped with Cygwin64 doesn't support multilib, you have
203to compile and deploy 32-bit and 64-bit binaries in separate steps.
204
2051. Compile and install 32-bit protobuf. `-static-libgcc -static-libstdc++` are
206 needed for `protoc` to be successfully run in the unit test.
207
208 ```bash
209 protobuf$ LDFLAGS="-static-libgcc -static-libstdc++" ./configure --host=i686-w64-mingw32 --disable-shared --prefix=$HOME/protobuf-32
210 protobuf$ make clean && make && make install
211 ```
212
2132. Compile and install 64-bit protobuf:
214
215 ```bash
216 protobuf$ ./configure --host=x86_64-w64-mingw32 --disable-shared --prefix=$HOME/protobuf-64
217 protobuf$ make clean && make && make install
218 ```
219
220### Mac
221Please refer to [Protobuf
222README](https://github.com/google/protobuf/blob/master/README.md) for how to
223set up GCC and Unix tools on Mac.
224
225Mac OS X has been 64-bit-only since 10.7 and we are compiling for 10.7 and up.
226We only build 64-bit artifact for Mac.
227
2281. Compile and install protobuf:
229
230 ```bash
231 protobuf$ CXXFLAGS="-m64" ./configure --disable-shared --prefix=$HOME/protobuf
232 protobuf$ make clean && make && make install
233 ```
2342. Configure CXXFLAGS needed by the protoc plugin when building.
235
236 ```bash
237 grpc-java$ export CXXFLAGS="-I$HOME/protobuf/include" \
238 LDFLAGS="$HOME/protobuf/lib/libprotobuf.a $HOME/protobuf/lib/libprotoc.a"
239 ```
240
241Build and Deploy
242----------------
243We currently distribute the following OSes and architectures:
244
245| OS | x86_32 | x86_64 |
246| --- | --- | --- |
247| Linux | X | X |
248| Windows | X | X |
249| Mac | | X |
250
251Deployment to Maven Central (or the snapshot repo) is a two-step process. The only
252artifact that is platform-specific is codegen, so we only need to deploy the other
253jars once. So the first deployment is for all of the artifacts from one of the selected
254OS/architectures. After that, we then deploy the codegen artifacts for the remaining
255OS/architectures.
256
257**NOTE: _Before building/deploying, be sure to switch to the appropriate branch or tag in
258the grpc-java source directory._**
259
260### First Deployment
261
262As stated above, this only needs to be done once for one of the selected OS/architectures.
263The following command will build the whole project and upload it to Maven
Eric Anderson41a9c942016-04-29 15:19:24 -0700264Central. Parallel building [is not safe during
265uploadArchives](https://issues.gradle.org/browse/GRADLE-3420).
nmittler483738e2015-06-08 14:32:37 -0700266```bash
Eric Anderson41a9c942016-04-29 15:19:24 -0700267grpc-java$ ./gradlew clean build && ./gradlew -Dorg.gradle.parallel=false uploadArchives
nmittler483738e2015-06-08 14:32:37 -0700268```
269
270If the version has the `-SNAPSHOT` suffix, the artifacts will automatically
271go to the snapshot repository. Otherwise it's a release deployment and the
272artifacts will go to a freshly created staging repository.
273
274### Deploy GRPC Codegen for Additional Platforms
275The previous step will only deploy the codegen artifacts for the OS you run on
276it and the architecture of your JVM. For a fully fledged deployment, you will
277need to deploy the codegen for all other supported OSes and architectures.
278
279To deploy the codegen for an OS and architecture, you must run the following
280commands on that OS and specify the architecture by the flag `-PtargetArch=<arch>`.
281
282If you are doing a snapshot deployment:
283
284```bash
Eric Anderson41a9c942016-04-29 15:19:24 -0700285grpc-java$ ./gradlew clean grpc-compiler:build grpc-compiler:uploadArchives \
286 -PtargetArch=<arch> -Dorg.gradle.parallel=false
nmittler483738e2015-06-08 14:32:37 -0700287```
288
289When deploying a Release, the first deployment will create
290[a new staging repository](https://oss.sonatype.org/#stagingRepositories). You'll need
291to look up the ID in the OSSRH UI (usually in the form of `iogrpc-*`). Codegen
292deployment commands should include `-PrepositoryId=<repository-id>` in order to
293ensure that the artifacts are pushed to the same staging repository.
294
295```bash
296grpc-java$ ./gradlew clean grpc-compiler:build grpc-compiler:uploadArchives -PtargetArch=<arch> \
Eric Anderson41a9c942016-04-29 15:19:24 -0700297 -PrepositoryId=<repository-id> -Dorg.gradle.parallel=false
nmittler483738e2015-06-08 14:32:37 -0700298```
299
300Releasing on Maven Central
301--------------------------
302Once all of the artifacts have been pushed to the staging repository, the
303repository must first be `closed`, which will trigger several sanity checks
304on the repository. If this completes successfully, the repository can then
305be `released`, which will begin the process of pushing the new artifacts to
306Maven Central (the staging repository will be destroyed in the process). You can
307see the complete process for releasing to Maven Central on the [OSSRH site]
308(http://central.sonatype.org/pages/releasing-the-deployment.html).
309
310Notify the Community
311--------------------
312After waiting ~1 day and verifying that the release appears on [Maven Central]
313(http://mvnrepository.com/), the last step is to document and publicize the release.
314
3151. Add [Release Notes](https://github.com/grpc/grpc-java/releases) for the new tag.
316 The description should include any major fixes or features since the last release.
317 You may choose to add links to bugs, PRs, or commits if appropriate.
3182. Post a release announcement to [grpc-io](https://groups.google.com/forum/#!forum/grpc-io)
319 (`grpc-io@googlegroups.com`). The title should be something that clearly identifies
320 the release (e.g.`GRPC-Java <tag> Released`).
Eric Andersone64c7552016-02-03 14:14:13 -0800321
322Update README.md
323----------------
324
325Update the version numbers in README.md to the new grpc-java version. _Also_
326update the version numbers for protoc if the protobuf library version was
327updated since last release. Make a new commit with description similar to
328"Update README to reference \<VERSION\>" and have it reviewed before submitting.
329
330Update Hosted Javadoc
331---------------------
332
Eric Anderson27d84892016-03-10 16:28:35 -0800333Now we need to update gh-pages with the new Javadoc:
Eric Andersone64c7552016-02-03 14:14:13 -0800334
335```bash
336git checkout gh-pages
337rm -r javadoc/
Eric Anderson27d84892016-03-10 16:28:35 -0800338wget -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"
339unzip -d javadoc grpc-all-javadoc.jar
340rm grpc-all-javadoc.jar
Eric Andersone64c7552016-02-03 14:14:13 -0800341rm -r javadoc/META-INF/
342git add -A javadoc
Eric Anderson27d84892016-03-10 16:28:35 -0800343git commit -m "Javadoc for $MAJOR.$MINOR.$PATCH"
Eric Andersone64c7552016-02-03 14:14:13 -0800344```
345
346Push gh-pages to the main repository and verify the current version is [live
347on grpc.io](http://www.grpc.io/grpc-java/javadoc/).