Setup sbt-ci-release (WIP)

This commit is contained in:
Alexandre Archambault 2018-10-17 14:18:03 +02:00
parent 3a65a3acf2
commit 3b81a4ad5e
6 changed files with 26 additions and 81 deletions

View File

@ -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

View File

@ -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"
)

View File

@ -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 := {
<developers>
<developer>
<id>alexarchambault</id>
<name>Alexandre Archambault</name>
<url>https://github.com/alexarchambault</url>
</developer>
</developers>
}
)
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
}

View File

@ -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,

View File

@ -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",

View File

@ -1 +0,0 @@
version in ThisBuild := "1.1.0-SNAPSHOT"