From 3b81a4ad5ef059e3fd37937313f0fb3b60c4ee56 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 17 Oct 2018 14:18:03 +0200 Subject: [PATCH] Setup sbt-ci-release (WIP) --- .travis.yml | 10 +++++- build.sbt | 18 ++++++++-- project/Publish.scala | 74 ------------------------------------------ project/Settings.scala | 3 +- project/plugins.sbt | 1 + version.sbt | 1 - 6 files changed, 26 insertions(+), 81 deletions(-) delete mode 100644 project/Publish.scala delete mode 100644 version.sbt diff --git a/.travis.yml b/.travis.yml index fc44bcdc4..1018354c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,21 @@ language: scala scala: 2.12.7 os: linux jdk: oraclejdk8 +before_install: + - git fetch --tags script: - scripts/travis.sh -matrix: +stages: + - name: test + - name: release + if: (branch = master AND type = push) OR (tag IS present) +jobs: include: - env: SBT_COURSIER=1 - env: SBT_SHADING=1 - env: SBT_PGP_COURSIER=1 + - stage: release + script: sbt ci-release branches: only: - master diff --git a/build.sbt b/build.sbt index cf57f7fe0..b9dd64cfe 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,20 @@ import Aliases._ import Settings._ -import Publish._ + +inThisBuild(List( + organization := "io.get-coursier", + homepage := Some(url("https://github.com/coursier/coursier")), + licenses := Seq("Apache 2.0" -> url("http://opensource.org/licenses/Apache-2.0")), + developers := List( + Developer( + "alexarchambault", + "Alexandre Archambault", + "", + url("https://github.com/alexarchambault") + ) + ) +)) val coursierVersion = "1.1.0-M7" @@ -89,8 +102,7 @@ lazy val coursier = project ) .settings( shared, - dontPublish, + skip.in(publish) := true, moduleName := "sbt-coursier-root" ) - diff --git a/project/Publish.scala b/project/Publish.scala deleted file mode 100644 index 2ba2a1ba0..000000000 --- a/project/Publish.scala +++ /dev/null @@ -1,74 +0,0 @@ - -import sbt._ -import sbt.Keys._ - -object Publish { - - lazy val dontPublish = Seq( - publish := {}, - publishLocal := {}, - publishArtifact := false - ) - - def dontPublishIn(sbv: String*) = Seq( - // Doesn't work, the second publish or publishLocal seem not to reference the previous implementation of the key. - // This only seems to prevent ivy.xml files to be published locally anyway… - // See also similar case in Settings.scala. - // publish := Def.taskDyn { - // if (sbv.contains(scalaBinaryVersion.value)) - // Def.task(()) - // else - // publish - // }, - // publishLocal := Def.taskDyn { - // if (sbv.contains(scalaBinaryVersion.value)) - // Def.task(()) - // else - // publishLocal - // }, - publishArtifact := { - !sbv.contains(scalaBinaryVersion.value) && publishArtifact.value - } - ) - - private def pomStuff = Seq( - licenses := Seq("Apache 2.0" -> url("http://opensource.org/licenses/Apache-2.0")), - homepage := Some(url("https://github.com/coursier/coursier")), - scmInfo := Some(ScmInfo( - url("https://github.com/coursier/coursier.git"), - "scm:git:github.com/coursier/coursier.git", - Some("scm:git:git@github.com:coursier/coursier.git") - )), - pomExtra := { - - - alexarchambault - Alexandre Archambault - https://github.com/alexarchambault - - - } - ) - - private def pushToSonatypeStuff = Seq( - publishMavenStyle := true, - 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") - }, - credentials ++= { - Seq("SONATYPE_USER", "SONATYPE_PASS").map(sys.env.get) match { - case Seq(Some(user), Some(pass)) => - Seq(Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass)) - case _ => - Seq() - } - } - ) - - lazy val released = pomStuff ++ pushToSonatypeStuff - -} diff --git a/project/Settings.scala b/project/Settings.scala index 3c3ae844b..840545e01 100644 --- a/project/Settings.scala +++ b/project/Settings.scala @@ -18,8 +18,7 @@ object Settings { resolvers += Resolver.sonatypeRepo(name) } - lazy val shared = Publish.released ++ Seq( - organization := "io.get-coursier", + lazy val shared = Seq( sonatypeRepository("releases"), crossScalaVersions := Seq(scala212), scalaVersion := scala212, diff --git a/project/plugins.sbt b/project/plugins.sbt index b561d716a..4547a2d5b 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,6 @@ plugins_( + "com.geirsson" % "sbt-ci-release" % "1.2.1", "io.get-coursier" % "sbt-coursier" % coursierVersion, "com.typesafe" % "sbt-mima-plugin" % "0.3.0", "com.jsuereth" % "sbt-pgp" % "1.1.1", diff --git a/version.sbt b/version.sbt deleted file mode 100644 index bd727575e..000000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -version in ThisBuild := "1.1.0-SNAPSHOT"