Skip to content

Releasing

Christopher Currie edited this page Aug 17, 2014 · 1 revision

The Scala module builds using SBT 0.13; follow the standard instructions to install SBT. Before starting a release, check the build.sbt file for any dependencies that may need to be updated (usually just the FasterXML dependencies). Use the sbt +test command to verify that the updated dependencies have not broken the module.

GPG credentials

Releasing to Sonatype requires gpg; create a public/private key pair using the standard tools. Once you have created your key pair, you will need the full key id of the signing public key. This is not usually displayed by the gpg command line tools. One way to get the full key id is to use the following command.

gpg --list-keys --with-colon | grep pub | cut -d : -f 5,10

Because different users can sign with different keys, the configuration for this is not stored within the project. To configure your installation of SBT for signing, create a $HOME/.sbt/0.13 directory. In this directory, create a file called gpg.sbt (it can be called anything as long at it ends with a .sbt extension) and give it the following contents:

usePgpKeyHex("FULLKEYID")

If you have a passphrase on your key (and you should) you can also add your passphrase to your configuration.

pgpPassphrase := Some(Array('P','A','S','S','P','H','R','A','S','E'))

The value must be an array of characters and not a string. You can also omit the passphrase and enter it on the commandline when prompted by SBT.

Sonatype credentials

To configure your Sonatype credentials, create a file called sonatype.sbt in the $HOME/.sbt/0.13 directory. (You can also use the same file you created for GPG credentials; I use separate files for clarity.) In this file, add the following:

credentials += Credentials("Sonatype Nexus Repository Manager",
                           "oss.sonatype.org",
                           "<your username>",
                           "<your password>")

If you don't want your credentials in a file, you'll need to specify them to SBT in the release process, as indicated below.

Running the release

The release can be run as a single sbt command:

sbt 'release cross with-defaults'

If you have configured SBT correctly, this will

  • Update the version.sbt file to remove the SNAPSHOT version and commit the change to git.
  • Build and test the module for each supported version of Scala
  • Sign the built modules
  • Push them to the Sonatype OSS repository
  • Update the version.sbt file to the next patch SNAPSHOT version and commit the change to git.
  • Push the git updates to the master repository

If you want to specify your Sonatype credentials on the command-line, you can do so:

sbt 'set credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", "SONATYPE_USER", "SONATYPE_PASS")' 'release cross with-defaults'
Clone this wiki locally