1One-time setup 2============== 3 4Set up Sonatype Account 5----------------------- 6* Sign up for a Sonatype JIRA account [here](https://issues.sonatype.org) 7* Click *Sign Up* in the login box, follow instructions 8 9Get access to repository 10------------------------ 11* Go to [community support](https://issues.sonatype.org/browse/OSSRH) 12* Ask for publish rights by creating an issue similar to [this one](https://issues.sonatype.org/browse/OSSRH-16798) 13 * You must be logged in to create a new issue 14 * Use the *Create* button at the top tab 15 16Set up PGP keys 17--------------- 18* Install GNU Privacy Guard (GPG) 19 * GPG is installed by default on Ubuntu systems 20 * For other systems, see [GnuPG download page](https://www.gnupg.org/download/) 21 22* Generate the key ```gpg --gen-key``` 23 24 * Keep the defaults, but specify a passphrase 25 * The passphrase can be random; you just need to remember it long enough to finish the next step 26 * One way to make a random passphrase: ```base64 /dev/urandom | head -c20; echo;``` 27 28* Find the ID of your public key ```gpg --list-secret-keys``` 29 * Look for the line with format ```sec 2048R/ABCDEFGH 2015-11-17``` 30 * The ```ABCDEFGH``` is the ID for your public key 31 32* Upload your public key to a public server: ```gpg --send-keys --keyserver hkp://pgp.mit.edu ABCDEFGH``` 33 * If you see the error, `gpg: keyserver send failed: No data`, try again in ~5m. The mit server semi-frequently has trouble accepting keys 34 35Create a Maven settings file 36---------------------------- 37* Create a file at ```$HOME/.m2/settings.xml``` with your passphrase and your sonatype username and password 38``` 39<settings> 40 <profiles> 41 <profile> 42 <id>ossrh</id> 43 <activation> 44 <activeByDefault>true</activeByDefault> 45 </activation> 46 <properties> 47 <gpg.executable>gpg</gpg.executable> 48 <gpg.passphrase>[the password for your gpg key]</gpg.passphrase> 49 </properties> 50 </profile> 51 </profiles> 52 <servers> 53 <server> 54 <id>ossrh</id> 55 <username>[your sonatype account name]</username> 56 <password>[your sonatype account password]</password> 57 </server> 58 </servers> 59</settings> 60``` 61 62To prepare a release 63==================== 64 65Versioning 66---------- 67Minor changes should be a point increase (0.6.0 -> 0.6.1). Additions to API or breaking changes should be 68a major release. (0.6.0 -> 0.7.0) 69 70Prepare release 71--------------- 72* Run `releasetool start`. Select "minor" or "patch" for the release type. This will bump the 73 artifact versions, ask you to edit release notes, and create the release pull request. 74* Run `mvn clean install deploy -DperformRelease=true` to stage the release. 75* Verify the result [here](https://oss.sonatype.org/#nexus-search;quick~com.google.auth). 76 * If there is a problem, undo by `mvn nexus-staging:drop`. 77 78Publish release 79--------------- 80* `mvn nexus-staging:release -DperformRelease=true` 81* It will take some time (10 minutes to 8 hours) for the package to be released 82* Confirm that the release appears in the [parent folder on Maven 83Central](https://repo1.maven.org/maven2/com/google/auth/google-auth-library-parent/) 84* If the release doesn't show up, do the following to check for failures: 85 * Go to [Sonatype](https://oss.sonatype.org/) and log in 86 * Click on *Staging Repositories* on the left 87 * Filter down to the repository by typing the package's groupId in the search box 88 * In our case, `com.google.auth` 89 * Click on the repository and check for errors 90* Submit the pull request to bump the version numbers 91* Update Javadoc on Github using `scripts/update_javadoc.sh`. 92* Run `releasetool tag` to create the GitHub release. 93* Run `releasetool start` to bump the next snapshot version. Select "snapshot" when prompted for 94 the release type. This will bump the artifact versions and create a pull request. 95* Review and submit the PR. 96 97Special cases 98============= 99 100Deploying version not at the head of the repository 101--------------------------------------------------- 102* Check out the version you want to deploy 103 * ```git checkout <ref>``` 104* Make sure all ```pom.xml``` file are not using ```SNAPSHOT``` versions 105* Proceed to **Deploy to Sonatype** 106