From 0aba1c02d93f1ad9b4411ccff592f9c304b8a5a2 Mon Sep 17 00:00:00 2001 From: Juan Pedro Moreno Date: Mon, 8 Aug 2016 11:57:07 +0200 Subject: [PATCH] Adds publish settings to the sbt configuration --- build.sbt | 3 ++- project/EvaluatorBuild.scala | 37 ++++++++++++++++++++++++++++++++++++ project/plugins.sbt | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index ca1bc0f1..525c581e 100644 --- a/build.sbt +++ b/build.sbt @@ -51,4 +51,5 @@ lazy val `evaluator-server` = (project in file("server")) ) .settings(compilerDependencySettings: _*) -onLoad in Global := (Command.process("project evaluator-server", _: State)) compose (onLoad in Global).value \ No newline at end of file +onLoad in Global := (Command.process("project evaluator-server", _: State)) compose (onLoad in Global).value +addCommandAlias("publishSignedAll", ";evaluator-shared/publishSigned;evaluator-client/publishSigned") \ No newline at end of file diff --git a/project/EvaluatorBuild.scala b/project/EvaluatorBuild.scala index 983f0e1b..e7fa38a4 100644 --- a/project/EvaluatorBuild.scala +++ b/project/EvaluatorBuild.scala @@ -2,6 +2,7 @@ import org.scalafmt.sbt.ScalaFmtPlugin import org.scalafmt.sbt.ScalaFmtPlugin.autoImport._ import de.heikoseeberger.sbtheader.{HeaderPattern, HeaderPlugin} import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport._ +import com.typesafe.sbt.SbtPgp.autoImport._ import sbt.Keys._ import sbt._ @@ -31,6 +32,7 @@ object EvaluatorBuild extends AutoPlugin { baseSettings ++ reformatOnCompileSettings ++ dependencySettings ++ + publishSettings ++ miscSettings @@ -91,4 +93,39 @@ object EvaluatorBuild extends AutoPlugin { s"$blue$projectName$white>${c.RESET}" } ) + + private[this] lazy val gpgFolder = sys.env.getOrElse("SE_GPG_FOLDER", ".") + + private[this] lazy val publishSettings = Seq( + organizationName := "Scala Exercises", + organizationHomepage := Some(new URL("http://scala-exercises.org")), + startYear := Some(2016), + description := "Scala Exercises: The path to enlightenment", + homepage := Some(url("http://scala-exercises.org")), + pgpPassphrase := Some(sys.env.getOrElse("SE_GPG_PASSPHRASE", "").toCharArray), + pgpPublicRing := file(s"$gpgFolder/pubring.gpg"), + pgpSecretRing := file(s"$gpgFolder/secring.gpg"), + credentials += Credentials( + "Sonatype Nexus Repository Manager", + "oss.sonatype.org", + sys.env.getOrElse("PUBLISH_USERNAME", ""), + sys.env.getOrElse("PUBLISH_PASSWORD", "")), + scmInfo := Some( + ScmInfo( + url("https://github.com/scala-exercises/evaluator"), + "https://github.com/scala-exercises/evaluator.git" + ) + ), + licenses := Seq("Apache License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")), + publishMavenStyle := true, + publishArtifact in Test := false, + pomIncludeRepository := Function.const(false), + publishTo := { + val nexus = "https://oss.sonatype.org/" + if (isSnapshot.value) + Some("Snapshots" at nexus + "content/repositories/snapshots") + else + Some("Releases" at nexus + "service/local/staging/deploy/maven2") + } + ) } \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index cb9aafca..85e4cdec 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,3 +1,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.1") addSbtPlugin("com.geirsson" % "sbt-scalafmt" % "0.2.11") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.6.0") +addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.1")