blob: e21b6cbf1e183cdf2f7a7722a85f31083c0583a6 [file] [log] [blame] [view]
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -07001# How to Create a Release of Instrumentation Java (for Maintainers Only)
2
3## Build Environments
4
5We deploy Instrumentation Java to Maven Central under the following systems:
6
7- Ubuntu 14.04
8
9Other systems may also work, but we haven't verified them.
10
11## Prerequisites
12
13### Setup OSSRH and Signing
14
15If you haven't deployed artifacts to Maven Central before, you need to setup
16your OSSRH (OSS Repository Hosting) account and signing keys.
17
18- Follow the instructions on [this
19 page](http://central.sonatype.org/pages/ossrh-guide.html) to set up an
20 account with OSSRH.
21 - You only need to create the account, not set up a new project
22 - Contact a Instrumentation Java maintainer to add your account after you
23 have created it.
24- (For release deployment only) [Install
25 GnuPG](http://central.sonatype.org/pages/working-with-pgp-signatures.html#installing-gnupg)
26 and [generate your key
27 pair](http://central.sonatype.org/pages/working-with-pgp-signatures.html#generating-a-key-pair).
28 You'll also need to [publish your public
29 key](http://central.sonatype.org/pages/working-with-pgp-signatures.html#distributing-your-public-key)
30 to make it visible to the Sonatype servers.
31- Put your GnuPG key password and OSSRH account information in
32 `<your-home-directory>/.gradle/gradle.properties`:
33
34 ```
35 # You need the signing properties only if you are making release deployment
36 signing.keyId=<8-character-public-key-id>
37 signing.password=<key-password>
38 signing.secretKeyRingFile=<your-home-directory>/.gnupg/secring.gpg
39
40 ossrhUsername=<ossrh-username>
41 ossrhPassword=<ossrh-password>
42 checkstyle.ignoreFailures=false
43 ```
44
45## Tagging the Release
46
47The first step in the release process is to create a release branch, bump
48versions, and create a tag for the release. Our release branches follow the
49naming convention of `v<major>.<minor>.x`, while the tags include the patch
50version `v<major>.<minor>.<patch>`. For example, the same branch `v0.4.x` would
51be used to create all `v0.4` tags (e.g. `v0.4.0`, `v0.4.1`).
52
53In this section upstream repository refers to the main instrumentation-java
54github repository.
55
Bogdan Drutuac9dd022017-04-17 13:03:01 -070056Before any push to the upstream repository you need to create a [personal access
57token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
58
Bogdan Drutu4e1c4fc2017-04-13 19:50:36 -0700591. Create the release branch and push it to GitHub:
60
61 ```bash
62 $ MAJOR=0 MINOR=4 PATCH=0 # Set appropriately for new release
63 $ VERSION_FILES=(
64 build.gradle
65 )
66 $ git checkout -b v$MAJOR.$MINOR.x master
67 $ git push upstream v$MAJOR.$MINOR.x
68 ```
69
702. For `master` branch:
71
72 - Change root build files to the next minor snapshot (e.g.
73 `0.5.0-SNAPSHOT`).
74
75 ```bash
76 $ git checkout -b bump-version master
77 # Change version to next minor (and keep -SNAPSHOT)
78 $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_INSTRUMENTATION_VERSION\)/'$MAJOR.$((MINOR+1)).0'\1/' \
79 "${VERSION_FILES[@]}"
80 $ ./gradlew build
81 $ git commit -a -m "Start $MAJOR.$((MINOR+1)).0 development cycle"
82 ```
83
84 - Go through PR review and push the master branch to GitHub:
85
86 ```bash
87 $ git checkout master
88 $ git merge --ff-only bump-version
89 $ git push upstream master
90 ```
91
923. For `vMajor.Minor.x` branch:
93
94 - Change root build files to remove "-SNAPSHOT" for the next release
95 version (e.g. `0.4.0`). Commit the result and make a tag:
96
97 ```bash
98 $ git checkout -b release v$MAJOR.$MINOR.x
99 # Change version to remove -SNAPSHOT
100 $ sed -i 's/-SNAPSHOT\(.*CURRENT_INSTRUMENTATION_VERSION\)/\1/' "${VERSION_FILES[@]}"
101 $ ./gradlew build
102 $ git commit -a -m "Bump version to $MAJOR.$MINOR.$PATCH"
103 $ git tag -a v$MAJOR.$MINOR.$PATCH -m "Version $MAJOR.$MINOR.$PATCH"
104 ```
105
106 - Change root build files to the next snapshot version (e.g.
107 `0.4.1-SNAPSHOT`). Commit the result:
108
109 ```bash
110 # Change version to next patch and add -SNAPSHOT
111 $ sed -i 's/[0-9]\+\.[0-9]\+\.[0-9]\+\(.*CURRENT_INSTRUMENTATION_VERSION\)/'$MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT'\1/' \
112 "${VERSION_FILES[@]}"
113 $ ./gradlew build
114 $ git commit -a -m "Bump version to $MAJOR.$MINOR.$((PATCH+1))-SNAPSHOT"
115 ```
116
117 - Go through PR review and push the release tag and updated release branch
118 to GitHub:
119
120 ```bash
121 $ git checkout v$MAJOR.$MINOR.x
122 $ git merge --ff-only release
123 $ git push upstream v$MAJOR.$MINOR.$PATCH
124 $ git push upstream v$MAJOR.$MINOR.x
125 ```
Bogdan Drutuac9dd022017-04-17 13:03:01 -0700126
127## Deployment
128
129Deployment to Maven Central (or the snapshot repo) is for all of the artifacts
130from the project.
131
132### Branch
133
134Before building/deploying, be sure to switch to the appropriate branch or tag.
135For the current release use:
136
137```bash
138$ git checkout -b v$MAJOR.$MINOR.$PATCH tags/v$MAJOR.$MINOR.$PATCH
139```
140
141### Initial Deployment
142
143The following command will build the whole project and upload it to Maven
144Central. Parallel building [is not safe during
145uploadArchives](https://issues.gradle.org/browse/GRADLE-3420).
146
147```bash
148$ ./gradlew clean build && ./gradlew -Dorg.gradle.parallel=false uploadArchives
149```
150
151If the version has the `-SNAPSHOT` suffix, the artifacts will automatically go
152to the snapshot repository. Otherwise it's a release deployment and the
153artifacts will go to a staging repository.
154
155When deploying a Release, the deployment will create [a new staging
156repository](https://oss.sonatype.org/#stagingRepositories). You'll need to look
157up the ID in the OSSRH UI (usually in the form of `instrumentation-*`).
158
159## Releasing on Maven Central
160
161Once all of the artifacts have been pushed to the staging repository, the
162repository must first be `closed`, which will trigger several sanity checks on
163the repository. If this completes successfully, the repository can then be
164`released`, which will begin the process of pushing the new artifacts to Maven
165Central (the staging repository will be destroyed in the process). You can see
166the complete process for releasing to Maven Central on the [OSSRH
167site](http://central.sonatype.org/pages/releasing-the-deployment.html).