Skip to content

Commit

Permalink
Upgrade sbt-sonatype, sbt-pgp
Browse files Browse the repository at this point in the history
The new sbt-sonatype adds a command to publish all modules in one
step (`sonatypeBundleRelease`) which should avoid getting into
inconsistent states (#7190, #6922).
  • Loading branch information
smarter committed Sep 10, 2019
1 parent 32b845a commit 54266c1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ steps:
- test_sbt
- test_java11
commands:
- ./project/scripts/sbtPublish ";dotty-bootstrapped/publishSigned ;sonatypeRelease"
- ./project/scripts/sbtPublish ";project dotty-bootstrapped ;publishSigned ;sonatypeBundleRelease"
environment:
NIGHTLYBUILD: yes
PGP_PW:
Expand Down Expand Up @@ -135,7 +135,7 @@ steps:
- test_java11
commands:
- ./project/scripts/sbt dist-bootstrapped/packArchive
- ./project/scripts/sbtPublish ";dotty-bootstrapped/publishSigned ;sonatypeRelease"
- ./project/scripts/sbtPublish ";project dotty-bootstrapped ;publishSigned ;sonatypeBundleRelease"
environment:
PGP_PW:
from_secret: pgp_pw
Expand Down Expand Up @@ -177,7 +177,7 @@ steps:
- test_sbt
- test_java11
commands:
- ./project/scripts/sbtPublish ";sbt-dotty/publishSigned ;sonatypeRelease"
- ./project/scripts/sbtPublish ";project sbt-dotty ;publishSigned ;sonatypeBundleRelease"
environment:
PGP_PW:
from_secret: pgp_pw
Expand Down
11 changes: 4 additions & 7 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import sbt.plugins.SbtPlugin
import sbt.ScriptedPlugin.autoImport._
import xerial.sbt.pack.PackPlugin
import xerial.sbt.pack.PackPlugin.autoImport._
import xerial.sbt.Sonatype.autoImport._

import dotty.tools.sbtplugin.DottyPlugin.autoImport._
import dotty.tools.sbtplugin.DottyPlugin.makeScalaInstance
Expand Down Expand Up @@ -198,7 +199,8 @@ object Build {
password <- sys.env.get("SONATYPE_PW")
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", username, password)
).toList,
PgpKeys.pgpPassphrase := sys.env.get("PGP_PW").map(_.toCharArray())
PgpKeys.pgpPassphrase := sys.env.get("PGP_PW").map(_.toCharArray()),
PgpKeys.useGpgPinentry := true,
)

lazy val commonSettings = publishSettings ++ Seq(
Expand Down Expand Up @@ -1150,12 +1152,7 @@ object Build {
lazy val publishSettings = Seq(
publishMavenStyle := true,
isSnapshot := version.value.contains("SNAPSHOT"),
publishTo := Some(
if (isSnapshot.value)
Opts.resolver.sonatypeSnapshots
else
Opts.resolver.sonatypeStaging
),
publishTo := sonatypePublishToBundle.value,
publishArtifact in Test := false,
homepage := Some(url(dottyGithubUrl)),
licenses += ("BSD New",
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.0-M8")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "2.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.6")

addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.0-M2")

addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.10.1")

Expand Down
6 changes: 3 additions & 3 deletions project/scripts/sbtPublish
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ if [ ! "$NIGHTLYBUILD" = "yes" ] && [ ! "$RELEASEBUILD" = "yes" ]; then
exit 1
fi

# Write down PGP secret key to the location expected by sbt-pgp
mkdir -p "$HOME/.sbt/gpg"
echo "$PGP_SECRET" > "$HOME/.sbt/gpg/secring.asc"
# Setup gpg
export GPG_TTY="$(tty)"
echo "$PGP_SECRET" | gpg --batch --import

# run sbt with the supplied arg
SBT="$(cd "$(dirname "${BASH_SOURCE[0]}")" >& /dev/null && pwd)/sbt"
Expand Down

0 comments on commit 54266c1

Please sign in to comment.