- Sign up for a Sonatype JIRA account here
- Click Sign Up in the login box, follow instructions
- Go to community support
- Ask for publish rights by creating an issue similar to this one
- You must be logged in to create a new issue
- Use the Create button at the top tab
-
Install GNU Privacy Guard (GPG)
- GPG is installed by default on Ubuntu systems
- For other systems, see GnuPG download page
-
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
- Look for the line with format
-
Upload your public key to a public server:
gpg --send-keys --keyserver hkp://pgp.mit.edu ABCDEFGH
- 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>
Make sure you are using Maven version 3.3 or higher to support the Nexus plugin required to stage a release.
-
Make sure the team agrees that it is time to release.
-
Look over all of the commits since the last release and make sure there are no breaking changes on the public surface. If there are any breaking changes, create and merge a new PR to revert the surface back.
Note - this should just be a scan of the public surface that would appear in Java doc. Implementation changes, README changes, and snippet changes can all be skipped for this check.
-
Verify that all unit and integration tests for the last commit have passed.
-
Run
python utilities/bump_versions.py next_release minor
from the repository's base directory. (If there are only bug fixes and no additions to the surface, usepatch
instead ofminor
.) Alternatively, update the versions inversions.txt
to the correct versions for the next release. -
Run
python utilities/replace_versions.py
from the repository's base directory. This updates the versions in allpom.xml
andREADME.md
files in preparation for a release. Commit these files locally:
git add .
git commit -m "Release [VERSION HERE]"
-
Create and merge in a PR to reflect the updated project version.
-
Run
git clean -x -f -d
to put the repo in a clean state. -
Locally build the repo by running
mvn install -DskipTests
. -
Run
python utilities/stage_sites.py
. This script checks outgh-pages
branch of the repository, builds the documentation site and javadocs, copies them to the branch and commits it. This script does not push the docs and it must be done manually on the later step. The script assumes that there is no directory calledtmp_gh-pages
in the repository root. If it is present, remove it before running the script. -
Locally edit the root
pom.xml
so thatmvn deploy
works: 1. Under<modules>
, comment outgoogle-cloud-examples
,google-cloud-testing
, andgoogle-cloud-util
. 2. Comment out thenexus-staging-maven-plugin
plugin definition at the end of the file. Don't commit these changes. -
Check that you are not trying to release a SNAPSHOT build (the artifacts versions do not have "-SNAPSHOT" suffix) and then run
mvn clean deploy -DskipTests=true --settings ~/.m2/settings.xml -P release
command. It will build and deploy artifacts to the staging repository. -
Run
mvn nexus-staging:release
to release the artifacts. -
Revert the local edits to your
pom.xml
performed a couple steps above by runninggit checkout pom.xml
. -
Run
cd tmp_gh-pages && git push && cd ..
to push the previously generated docs (step 8). -
Run
rm -rf tmp_gh-pages
to remove the generated docs directory from your local machine. -
Publish a release on Github manually. Go to the releases page and open the appropriate release draft. Make sure the "Tag Version" is
vX.Y.Z
and the "Release Title" isX.Y.Z
, whereX.Y.Z
is the release version as listed in thepom.xml
files.
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). After adding any missing updates and reformatting as necessary, publish the draft.
-
Run
python utilities/bump_versions.py next_snapshot patch
to include "-SNAPSHOT" in the current project version (Alternatively, update the versions inversions.txt
to the correct versions for the next release.). Then, runpython utilities/replace_versions.py
to update thepom.xml
files. (If you see updates inREADME.md
files at this step, you probably did something wrong.) -
Create and merge in another PR to reflect the updated project version.
Automatic tagging is not currently implemented, though it was discussed in #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.