Skip to content

Commit

Permalink
Merge pull request #5 from 2m/wip-plugin-requirement-2m
Browse files Browse the repository at this point in the history
Add dependency to sbt-pgp plugins
  • Loading branch information
olafurpg authored Jun 12, 2018
2 parents 8d83b60 + e53b068 commit 19f001d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
7 changes: 0 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,3 @@ lazy val plugin = project
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.3"),
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())
)
)
7 changes: 5 additions & 2 deletions plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala
Original file line number Diff line number Diff line change
@@ -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._
Expand All @@ -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)
Expand All @@ -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(
Expand Down
8 changes: 0 additions & 8 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 19f001d

Please sign in to comment.