From ac73eafa7985caac1d4b802eefc34fde67a7732e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Mickevi=C4=8Dius?= Date: Tue, 12 Jun 2018 13:38:45 +0200 Subject: [PATCH 1/2] Add dependency to sbt-pgp plugins --- build.sbt | 6 ------ plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala | 7 +++++-- readme.md | 8 -------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/build.sbt b/build.sbt index 710cc86..c1d843e 100644 --- a/build.sbt +++ b/build.sbt @@ -34,9 +34,3 @@ lazy val plugin = project addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") ) -// For some reason, it doesn't work if this is defined in buildSettings in CiReleasePlugin. -inScope(Global)( - Seq( - PgpKeys.pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()) - ) -) diff --git a/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala b/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala index 41cf778..423b08f 100644 --- a/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala +++ b/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala @@ -1,6 +1,8 @@ package com.geirsson import sbtdynver.DynVerPlugin.autoImport._ +import com.typesafe.sbt.SbtPgp +import com.typesafe.sbt.SbtPgp.autoImport._ import sbt.Def import sbt._ import sbt.Keys._ @@ -10,7 +12,7 @@ import sys.process._ object CiReleasePlugin extends AutoPlugin { override def trigger = allRequirements - override def requires = JvmPlugin + override def requires = JvmPlugin && SbtPgp def isTravisTag: Boolean = Option(System.getenv("TRAVIS_TAG")).exists(_.nonEmpty) @@ -22,7 +24,8 @@ object CiReleasePlugin extends AutoPlugin { } override def buildSettings: Seq[Def.Setting[_]] = List( - dynverSonatypeSnapshots := true + dynverSonatypeSnapshots := true, + pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()), ) override def globalSettings: Seq[Def.Setting[_]] = List( diff --git a/readme.md b/readme.md index b9dd529..f03554a 100644 --- a/readme.md +++ b/readme.md @@ -61,14 +61,6 @@ inThisBuild(List( )) ``` -Next, copy-paste the following to the bottom of `build.sbt` - -```scala -inScope(Global)(List( - PgpKeys.pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()) -)) -``` - Next, create a fresh gpg key that you will share with Travis CI and only use for this project. From e53b068e6dbf3f6d52e44d4ee16832944ab1c1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martynas=20Mickevi=C4=8Dius?= Date: Tue, 12 Jun 2018 13:48:18 +0200 Subject: [PATCH 2/2] Fix formatting --- build.sbt | 1 - plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index c1d843e..7a8c977 100644 --- a/build.sbt +++ b/build.sbt @@ -33,4 +33,3 @@ lazy val plugin = project addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3"), addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0") ) - diff --git a/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala b/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala index 423b08f..d159f3e 100644 --- a/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala +++ b/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala @@ -25,7 +25,7 @@ object CiReleasePlugin extends AutoPlugin { override def buildSettings: Seq[Def.Setting[_]] = List( dynverSonatypeSnapshots := true, - pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()), + pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()) ) override def globalSettings: Seq[Def.Setting[_]] = List(