Good resources:
- https://www.querki.net/u/jducoeur/scala-notes/#!Creating-a-Scalajs-Open-Source-Project
- https://www.scala-sbt.org/1.x/docs/Using-Sonatype.html#Third+-+Publish+to+the+staging+repository
- Create Sonatype account
-
Install
gpg
e.g. on OSX:brew install gpg
-
Run
gpg --gen-key
to generate a new key. Remember the passphrase and email you you used. -
List your key:
> gpg --list-keys [email protected] pub rsa2048 2018-07-24 [SC] [expires: 2020-07-23] F5003E5C4718B1F466B244F766AA02EC8AA60DB9 uid [ultimate] Pathikrit Bhowmick <[email protected]> sub rsa2048 2018-07-24 [E] [expires: 2020-07-23]
-
Publish your key:
> gpg --keyserver hkp://pool.sks-keyservers.net --send-keys F5003E5C4718B1F466B244F766AA02EC8AA60DB9 gpg: WARNING: server 'dirmngr' is older than us (2.2.7 < 2.2.9) gpg: Note: Outdated servers may lack important security fixes. gpg: Note: Use the command "gpgconf --kill all" to restart them. gpg: sending key 66AA02EC8AA60DB9 to hkp://pool.sks-keyservers.net
You can verify the key got published by looking at: http://pool.sks-keyservers.net/pks/lookup?search=0x66AA02EC8AA60DB9
-
Append following to this file (
~/.sbt/${SBT_VERSION}/sonatype.sbt
):credentials += Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", "<your username>", "<your password>")
-
Create new JIRA issue using your Sonatype account to request new repo
-
Wait till above issue is resolved
-
Add
sbt-pgp
,sbt-release
andsbt-sonatype
as a plugin to your project. Here is an example plugins.sbt:addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.0") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.5.1")
-
Here is an example build.sbt that I use for multi-projects.
sbt +release
(will prompt for passphrase that you created forgpg
)- Note: The
+release
cross releases across your specifiedcrossScalaVersions
. If you havepushChanges
enabled in your build to push your commit to git remote, make sure you dopushChanges
once only on the lastcrossVersion
. - View artifact on Sonatype (the snapshot versions are here)
- Wait few hours for it to propagate to Maven Central