Skip to content

Commit

Permalink
Add sonatypeReleaseBundleIfNotSnapshot to build.sbt
Browse files Browse the repository at this point in the history
  • Loading branch information
mvv committed Nov 24, 2019
1 parent 17327b2 commit d3f6d84
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -43,7 +43,7 @@ jobs:
stage: publish
name: "Publish"
before_script: gpg --import project/ci.asc
script: sbt +publish sonatypeBundleRelease
script: sbt +publish sonatypeBundleReleaseIfNotSnapshot

env:
global:
Expand Down
11 changes: 11 additions & 0 deletions build.sbt
Expand Up @@ -22,6 +22,17 @@ inThisBuild(
ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / publishMavenStyle := true

lazy val sonatypeBundleReleaseIfNotSnapshot =
taskKey[String]("Release a bundle to Sonatype (if not SNAPSHOT)")

ThisBuild / sonatypeBundleReleaseIfNotSnapshot := Def.taskDyn {
if (isSnapshot.value) {
Def.task { "SNAPSHOT" }
} else {
Def.task { (sonatypeBundleRelease in publish).value }
}
}.value

inThisBuild(
Seq(
crossScalaVersions := Seq("2.13.1", "2.12.10", "2.11.12"),
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
@@ -1,3 +1,3 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.2.1")
addSbtPlugin("io.crashbox" % "sbt-gpg" % "0.2.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.8.1")

0 comments on commit d3f6d84

Please sign in to comment.