A plugin for deploying open-source artifacts to Maven via the Sonatype Central portal
Prerequisites: Make sure that you are running sbt 1.9.0 or higher.
project/plugins.sbt
file (or equivalent):addSbtPlugin("com.lumidion" % "sbt-sonatype-central" % "0.1.0") //For deploying your lib to Sonatype Central
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") //For signing the lib before it is deployed
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1") //For adding source control information to your package.
build.sbt
file (or equivalent):publishTo := sonatypeCentralPublishToBundle.value
Follow the guide to setting up your gpg credentials here if you have not already done so.
Generate a portal token in Sonatype Central, as illustrated in the following guide. Set the resultant username and password in your environment via the SONATYPE_USERNAME
and SONATYPE_PASSWORD
environment variables.
Start the sbt shell by running sbt
.
Run publishSigned
from the sbt shell and input your gpg password when prompted.
Run either sonatypeCentralUpload
or sonatypeCentralRelease
from the sbt shell.