aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.sbt18
-rw-r--r--project/SttpRelease.scala42
-rw-r--r--project/plugins.sbt2
-rw-r--r--version.sbt2
4 files changed, 54 insertions, 10 deletions
diff --git a/build.sbt b/build.sbt
index b70625d..2ab11db 100644
--- a/build.sbt
+++ b/build.sbt
@@ -6,14 +6,12 @@ val commonSettings = Seq(
scalafmtOnCompile := true,
scalafmtVersion := "1.0.0",
// publishing
- publishTo := {
- val nexus = "https://oss.sonatype.org/"
- val (name, url) =
- if (isSnapshot.value)
- ("snapshots", nexus + "content/repositories/snapshots")
- else ("releases", nexus + "service/local/staging/deploy/maven2")
- Some(name at url)
- },
+ publishTo := Some(
+ if (isSnapshot.value)
+ Opts.resolver.sonatypeSnapshots
+ else
+ Opts.resolver.sonatypeStaging
+ ),
publishArtifact in Test := false,
publishMavenStyle := true,
scmInfo := Some(
@@ -24,10 +22,12 @@ val commonSettings = Seq(
licenses := ("Apache-2.0",
url("http://www.apache.org/licenses/LICENSE-2.0.txt")) :: Nil,
homepage := Some(url("http://softwaremill.com/open-source")),
+ sonatypeProfileName := "com.softwaremill",
// sbt-release
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
- releaseIgnoreUntrackedFiles := true
+ releaseIgnoreUntrackedFiles := true,
+ releaseProcess := SttpRelease.steps
)
val akkaHttpVersion = "10.0.9"
diff --git a/project/SttpRelease.scala b/project/SttpRelease.scala
new file mode 100644
index 0000000..9e96eb6
--- /dev/null
+++ b/project/SttpRelease.scala
@@ -0,0 +1,42 @@
+import java.util.regex.Pattern
+
+import sbt._
+import sbtrelease.ReleasePlugin.autoImport.ReleaseKeys._
+import sbtrelease.ReleasePlugin.autoImport.ReleaseStep
+import sbtrelease.ReleaseStateTransformations._
+
+object SttpRelease {
+ def steps: Seq[ReleaseStep] = Seq(
+ checkSnapshotDependencies,
+ inquireVersions,
+ runClean,
+ runTest,
+ setReleaseVersion,
+ updateVersionInReadme,
+ commitReleaseVersion,
+ tagRelease,
+ ReleaseStep(action = Command.process("publishSigned", _)),
+ setNextVersion,
+ commitNextVersion,
+ ReleaseStep(action = Command.process("sonatypeReleaseAll", _)),
+ pushChanges
+ )
+
+ // based on https://github.com/EECOLOR/sbt-release-custom-steps/blob/master/src/main/scala/org/qirx/sbtrelease/UpdateVersionInFiles.scala
+ private def updateVersionInReadme: ReleaseStep = { s: State =>
+ val readmeFile = file("README.md")
+ val readme = IO.read(readmeFile)
+
+ val currentVersionPattern = """"com.softwaremill.sttp" %% "core" % "([\w\.-]+)"""".r
+ val currentVersionInReadme = currentVersionPattern.findFirstMatchIn(readme).get.group(1)
+
+ val releaseVersion = s.get(versions).get._1
+
+ s.log.info(s"Replacing $currentVersionInReadme with $releaseVersion in ${readmeFile.name}")
+
+ val newReadme = readme.replaceAll(Pattern.quote(currentVersionInReadme), releaseVersion)
+ IO.write(readmeFile, newReadme)
+
+ s
+ }
+}
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 7b64831..e8687f4 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -2,6 +2,8 @@ addSbtPlugin("com.lucidchart" % "sbt-scalafmt" % "1.8")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC8")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "1.1")
+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.5") \ No newline at end of file
diff --git a/version.sbt b/version.sbt
index 91ea14c..ce4936a 100644
--- a/version.sbt
+++ b/version.sbt
@@ -1 +1 @@
-version in ThisBuild := "0.0.1"
+version in ThisBuild := "0.0.1.1"