Skip to content

Commit

Permalink
Update release instructions and scripts (googleapis#2120)
Browse files Browse the repository at this point in the history
* Update release instructions and scripts

* Address PR feedback

* Remove empty line
  • Loading branch information
tcoffee-google authored Jun 6, 2017
1 parent 29bab84 commit 4163936
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 11 deletions.
99 changes: 89 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,74 @@
### Overview

The release process for SNAPSHOT versions is handled by the `after_success.sh` script, triggered after Travis CI successfully completes a non-PR build. A new SNAPSHOT artifact will be released to the snapshot repository as part of this script.

### To push a release version
One-time setup
==============

Set up Sonatype Account
-----------------------
* Sign up for a Sonatype JIRA account [here](https://issues.sonatype.org)
* Click *Sign Up* in the login box, follow instructions

Get access to repository
------------------------
* Go to [community support](https://issues.sonatype.org/browse/OSSRH)
* Ask for publish rights by creating an issue similar to [this one](https://issues.sonatype.org/browse/OSSRH-32032)
* You must be logged in to create a new issue
* Use the *Create* button at the top tab

Set up PGP keys
---------------
* Install GNU Privacy Guard (GPG)
* GPG is installed by default on Ubuntu systems
* For other systems, see [GnuPG download page](https://www.gnupg.org/download/)

* Generate the key ```gpg --gen-key```
* Keep the defaults, but specify a passphrase
* The passphrase can be random; you just need to remember it long enough to finish the next step
* One way to make a random passphrase: ```base64 /dev/urandom | head -c20; echo;```

* Find the ID of your public key ```gpg --list-secret-keys```
* Look for the line with format ```sec 2048R/ABCDEFGH 2015-11-17```
* The ```ABCDEFGH``` is the ID for your public key

* Upload your public key to a public server: ```gpg --send-keys --keyserver hkp://pgp.mit.edu ABCDEFGH```

Create a Maven settings file
----------------------------
* Create a file at ```$HOME/.m2/settings.xml``` with your passphrase and your sonatype username and password
```
<settings>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>[the password for your gpg key]</gpg.passphrase>
</properties>
</profile>
</profiles>
<servers>
<server>
<id>ossrh</id>
<username>[your sonatype account name]</username>
<password>[your sonatype account password]</password>
</server>
<server>
<id>sonatype-nexus-snapshots</id>
<username>[your sonatype account name]</username>
<password>[your sonatype account password]</password>
</server>
<server>
<id>sonatype-nexus-staging</id>
<username>[your sonatype account name]</username>
<password>[your sonatype account password]</password>
</server>
</servers>
</settings>
```

To push a release version
=========================

1. Make sure the team agrees that it is time to release.

Expand All @@ -19,10 +85,19 @@ This script takes optional arguments denoting the new versions for each qualifie
git add .
git commit -m "Release [VERSION HERE]"
```


1. Make sure you are using Maven version 3.3 or higher to support the Nexus plugin required to stage a release.

1. To ensure a clean build, remove *all* Maven targets (including subdirectories not handled by `mvn clean`) by running `rm -rf target */target`.

5. Run `utilities/stage_release.sh`.
This script builds and stages the release artifact on the Maven Central Repository, updates the README.md files with the release version + commits them locally, and finally generates a new site version for the gh-pages branch under a temporary directory named `tmp_gh-pages`. If you haven't run the release process before, it's worth verifying everything; check the staged release on the Sonatype website, and verify that the local commits have the right version updates.

If you experience failures, you may need to:
- repeat the clean step above
- remove the temporary directory created to store docs by running `rm -rf tmp_gh-pages`
- remove staged repositories from Sonatype (to prevent them from being released in subsequent steps): if a staged repository appears [here](https://oss.sonatype.org/#nexus-search;quick~com.google.cloud), remove it by running `mvn nexus-staging:drop`.

6. Run `utilities/finalize_release.sh`.
This script will release the staged artifact on the Maven Central Repository and push the README.md and gh-pages updates to github.

Expand All @@ -31,16 +106,20 @@ Go to the [releases page](https://github.com/GoogleCloudPlatform/google-cloud-ja

Add the commits since the last release into the release draft. Try to group them into sections with related changes. Anything that is a breaking change needs to be marked with `*breaking change*`. Such changes are only allowed for alpha/beta modules and `@BetaApi` features.

Ensure that the format is consistent with previous releases (for an example, see the [0.1.0 release](https://github.com/GoogleCloudPlatform/google-cloud-java/releases/tag/v0.1.0)). After adding any missing updates and reformatting as necessary, publish the draft. Finally, create a new draft for the next release.
Ensure that the format is consistent with previous releases (for an example, see the [0.1.0 release](https://github.com/GoogleCloudPlatform/google-cloud-java/releases/tag/v0.1.0)). After adding any missing updates and reformatting as necessary, publish the draft.

1. Create a new draft for the next release. Note any commits not included in the release that have been submitted before the release commit, to ensure they are documented in the next release.

8. Run `utilities/update_versions.sh` again (to include "-SNAPSHOT" in the project version). Please refer to documentation in `utilities/update_versions.sh` for more details.

9. Create and merge in another PR to reflect the updated project version. For an example of what this PR should look like, see [#227](https://github.com/GoogleCloudPlatform/google-cloud-java/pull/227).

### To push a snapshot version
To push a snapshot version
==========================

Pushing a snapshot is completely automated. If "-SNAPSHOT" is included in the version denoted by the base directory's pom.xml, then an updated artifact will be pushed to the snapshot repository when Travis CI successfully completes a non-PR build.
Pushing a snapshot is completely automated. If "-SNAPSHOT" is included in the version denoted by the base directory's pom.xml, then an updated artifact will be pushed to the snapshot repository when Travis CI successfully completes a non-PR build. The build triggers the `after_success.sh` script, which handles the release process for SNAPSHOT versions.

### Improvements
Improvements
============

Automatic tagging is not currently implemented, though it was discussed in [#119](https://github.com/GoogleCloudPlatform/google-cloud-java/pull/119). If the version updates continue to be manual, a one-line git tag command can be added to `after_success.sh` to correctly tag releases. However, automatically creating useful annotations for this tag will be difficult. Also, if the release process becomes fully automated, tagging becomes a harder problem, as mentioned in that issue.
6 changes: 5 additions & 1 deletion utilities/finalize_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ mvn nexus-staging:release
git push

# Push the gh-pages updates
cd tmp_gh-pages
pushd tmp_gh-pages
git push
popd

# Remove gh-pages temporary directory
rm -rf tmp_gh-pages
6 changes: 6 additions & 0 deletions utilities/update_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ BETA_VERSION=""
RC_VERSION=""
GA_VERSION=""

# uncomment module for GAE testing apps to enable detection (re-commented below)
sed -i -e 's:<!--<module>google-cloud-testing</module>-->:<module>google-cloud-testing</module>:' pom.xml

for i in "$@"
do
case $i in
Expand Down Expand Up @@ -269,3 +272,6 @@ for item in ${modules[*]}; do
fi
fi
done

# re-comment module for GAE testing apps
sed -i -e 's:<module>google-cloud-testing</module>:<!--<module>google-cloud-testing</module>-->:' pom.xml

0 comments on commit 4163936

Please sign in to comment.