|
1 | | -# Release Process |
| 1 | +# Release process |
2 | 2 |
|
3 | | -* code: https://github.com/watson-developer-cloud/java-sdk |
4 | | -* maven: http://search.maven.org/#search%7Cga%7C1%7Ca%3A%22java-sdk%22 |
| 3 | +The Java SDK has been configured so that releases should happen **automatically**. |
5 | 4 |
|
6 | | -## Guide to uploading artifacts to the Central Repository |
| 5 | +If everything goes smoothly, commits to `master` should trigger new package versions using [semantic-release](https://github.com/semantic-release/semantic-release), which bases the release type (major, minor, patch, none) on the commit messages, which should always follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). |
7 | 6 |
|
8 | | -We use Sonatype as repository manager, it's used as the input channel for the Central Repository running the Sonatype Open Source Repository Hosting(OSSRH) service. |
| 7 | +When new versions are released, the code is pushed to Bintray and synced to Maven Central. The packages can be found [here](https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo) on Bintray and [here](https://search.maven.org/search?q=com.ibm.watson) on Maven Central. |
9 | 8 |
|
10 | | -### Prerequisites |
| 9 | +The Javadocs for the new version should also be pushed automatically. Docs are located in the `gh-pages` branch of the repo, and that gets synced to the following GitHub Pages link: http://watson-developer-cloud.github.io/java-sdk/ |
11 | 10 |
|
12 | | -If you are not familiar with Sonatype and/or the maven release process please read the following material: |
| 11 | +If things **don't** go smoothly, you'll need to follow some other instructions to get things in order. |
13 | 12 |
|
14 | | -* Sonatype: http://central.sonatype.org/pages/apache-maven.html |
15 | | -* Releasing artifacts to Sonatype: http://kirang89.github.io/blog/2013/01/20/uploading-your-jar-to-maven-central/ |
16 | | -* Install GPG, and create a public key. More info: http://central.sonatype.org/pages/working-with-pgp-signatures.html |
| 13 | +## Fixing broken releases |
17 | 14 |
|
18 | | -### Releasing |
19 | | -As part of your PR into `master` for a release, make a commit updating version number strings across the SDK. To do this, we use [bumpversion](https://github.com/peritus/bumpversion). |
| 15 | +### Travis timeouts |
20 | 16 |
|
21 | | -To use `bumpversion`, simply run the following command with the proper semantic version for your desired release: |
22 | | -```bash |
23 | | -bumpversion major|minor|patch |
24 | | -``` |
| 17 | +The most common reason for a release to fail is because of a Travis timeout. Builds are only allowed to run for a maximum of 1 hour, and unfortunately the syncing process between Bintray and Maven Central can be slow enough to go over this time limit sometimes. If this happens, you should do the following: |
25 | 18 |
|
26 | | -After you've merged your PR and After the `master` branch successfully builds from the release changes, check out the `master` branch and perform a release deployment to OSSRH (Staging) with: |
27 | | -```bash |
28 | | -gradle release |
29 | | -``` |
30 | | -You will have to answer prompts for versions and tags. That will tag and commit a new version into your repository automatically. |
| 19 | +- Navigate to the code on Bintray at [this URL](https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo). If you're not a member of the ibm-cloud-sdks organization, ask the maintainer of this SDK repo for access. |
| 20 | +- Navigate to the "Maven Central" tab in each of the packages that didn't sync. Here's an example: https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo/com.ibm.watson%3Alanguage-translator#central. You can figure out which packages to sync manually by checking the failed Travis build log or by looking at the "Last Synced" date for the package. |
| 21 | +- Click the "Sync" button. If you need to provide Sonatype credentials, you can also ask the maintainer of this SDK repo for those. |
31 | 22 |
|
32 | | -After the above commits pass, `git checkout` the new tag branch for your release. In that branch, execute the following command: |
| 23 | + <img alt="Bintray sync" width="600" src="./.github/bintray-sync.png"> |
33 | 24 |
|
34 | | -```bash |
35 | | -./gradlew uploadArchives -Psigning.keyId=<keyId> -Psigning.password=<keyPassword> -Psigning.secretKeyRingFile=<pathToKeyRingFile> -PossrhUsername=<sonatypeUsername> -PossrhPassword=<sonatypePassword> |
36 | | -``` |
| 25 | +- After doing this with all of the necessary packages, you can verify that things worked by checking the available versions on [Maven Central](https://search.maven.org/search?q=com.ibm.watson). This could take up to an hour. |
37 | 26 |
|
38 | | -The arguments should be populated with the following: |
39 | | -- `-Psigning.keyId`: The ID of your public key you created after following the link in the prerequisites |
40 | | -- `-Psigning.password`: Your password you created for making public GPG keys |
41 | | -- `-Psigning.secretKeyRingFile`: After creating your public key, you create your keyring file with the following command and use the absolute path to your new file: |
| 27 | +### Unsuccessful Bintray deployment |
42 | 28 |
|
43 | | -```bash |
44 | | -gpg --export-secret-keys -o <outputFilename>.gpg |
45 | | -``` |
| 29 | +This case is much more unlikely, since integration tests don't run on `master` and builds are very unlikely to be passing in a PR but fail once it's merged. Nevertheless, if this does happen and files aren't deployed to Bintray, you'll need to follow some steps to do this manually: |
46 | 30 |
|
47 | | -- `-PossrhUsername`: Your Sonatype username |
48 | | -- `-PossrhPassword`: Your Sonatype password |
| 31 | +- Navigate to the code on Bintray at [this URL](https://bintray.com/ibm-cloud-sdks/ibm-cloud-sdk-repo). If you're not a member of the ibm-cloud-sdks organization, ask the maintainer of this SDK repo for access. |
| 32 | +- For each package in the SDK, if the new version isn't present, you can add it by navigating to the package and adding it manually: |
49 | 33 |
|
50 | | -Assuming this command works properly, you should be able to then log into Sonatype and close and release the repository. |
| 34 | + <img alt="Bintray new version" width="600" src="./.github/bintray-new-version.png"> |
| 35 | + |
| 36 | +- To add the files, make sure to first generate all of the necessary artifacts locally. Check out the new release tag and generate them with the following commands (from the SDK repo): |
| 37 | + ``` |
| 38 | + git checkout {release tag} |
| 39 | + ./gradlew shadowJar |
| 40 | + ``` |
| 41 | +- In the new version of the package on Bintray, add the files with the "Upload Files" button. Follow the file structure of previous releases to ensure everything works properly. The files to add should be in the `build/libs` folder of each local package in the SDK. |
| 42 | + |
| 43 | + <img alt="Bintray upload files" width="600" src="./.github/bintray-upload-files.png"> |
| 44 | + |
| 45 | +- Finally, be sure to sync the artifacts with Maven Central. You can look at the [Travis timeouts](#travis-timeouts) section above for more information on this. |
0 commit comments