diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..fbff884
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,20 @@
+name: Release
+on:
+ push:
+ branches: ["*"]
+jobs:
+ build:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2.3.4
+ with:
+ fetch-depth: 0
+ - uses: olafurpg/setup-scala@v10
+ - run: sbt clean test
+ - uses: blended-zio/setup-gpg@v3
+ - run: sbt ci-publish
+ env:
+ PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
+ PGP_SECRET: ${{ secrets.PGP_SECRET }}
+ SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
+ SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
diff --git a/.gitignore b/.gitignore
index 953ed99..626809a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+.bsp
.idea
.idea_modules
target
@@ -6,4 +7,4 @@ publish/releases
publish/gpg
bin
todo.txt
-logs
\ No newline at end of file
+logs
diff --git a/build.sbt b/build.sbt
index d6f6cfe..fbabb86 100644
--- a/build.sbt
+++ b/build.sbt
@@ -1,5 +1,3 @@
-import bintray.Keys.{bintray, bintrayOrganization, repository}
-
import scala.util.Try
name := "scala-embedded-jetty"
@@ -8,46 +6,29 @@ organization := "io.shaka"
version := Try(sys.env("LIB_VERSION")).getOrElse("1")
-scalaVersion := "2.12.0"
+scalaVersion := "2.13.5"
-crossScalaVersions := Seq("2.11.8", "2.12.0")
+crossScalaVersions := Seq("2.12.13", "2.13.5")
-val jettyVersion = "9.2.11.v20150529"
+homepage := Some(url("https://github.com/timt/scala-embedded-jetty"))
+
+licenses +=("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html"))
-externalResolvers := Seq("Bintray JCenter" at "https://jcenter.bintray.com/")
+val jettyVersion = "9.2.11.v20150529"
libraryDependencies ++= Seq(
"org.eclipse.jetty" % "jetty-webapp" % jettyVersion % "provided",
"org.eclipse.jetty" % "jetty-servlets" % jettyVersion % "provided",
- "io.shaka" %% "naive-http" % "90" % "provided",
- "org.scalatest" %% "scalatest" % "3.0.0" % "test"
+ "io.shaka" %% "naive-http" % "122" % "provided",
+ "org.scalatest" %% "scalatest" % "3.1.2" % "test"
)
-pgpPassphrase := Some(Try(sys.env("SECRET")).getOrElse("goaway").toCharArray)
-
-pgpSecretRing := file("./publish/sonatype.asc")
-
-bintrayPublishSettings
-
-repository in bintray := "repo"
+developers := List(
+ Developer("timt", "Tim Tennant", "", url("https://github.com/timt"))
+)
-bintrayOrganization in bintray := None
+usePgpKeyHex("timt-ci bot")
publishMavenStyle := true
-publishArtifact in Test := false
-
-homepage := Some(url("https://github.com/timt/scala-embedded-jetty"))
-
-licenses +=("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html"))
-
-pomExtra :=
-
- git@github.com:timt/scala-embedded-jetty.git
- scm:git:git@github.com:timt/scala-embedded-jetty.git
-
-
-
- timt
-
-
+publishArtifact in Test := false
\ No newline at end of file
diff --git a/project/CiPublishPlugin.scala b/project/CiPublishPlugin.scala
new file mode 100644
index 0000000..139185e
--- /dev/null
+++ b/project/CiPublishPlugin.scala
@@ -0,0 +1,97 @@
+import com.jsuereth.sbtpgp.SbtPgp
+import com.typesafe.sbt.GitPlugin
+import sbt.Keys._
+import sbt.{Def, _}
+import sbt.plugins.JvmPlugin
+import xerial.sbt.Sonatype
+import xerial.sbt.Sonatype.autoImport._
+
+import scala.sys.process._
+import scala.util.control.NonFatal
+
+object CiPublishPlugin extends AutoPlugin {
+
+ override def trigger: PluginTrigger = allRequirements
+ override def requires: Plugins = JvmPlugin && SbtPgp && GitPlugin && Sonatype
+
+ def isSecure: Boolean =
+ System.getenv("PGP_SECRET") != null
+
+ def setupGpg(): Unit = {
+ val versionLine = List("gpg", "--version").!!.linesIterator.toList.head
+
+ println(versionLine)
+
+ val TaggedVersion = """(\d{1,14})([\.\d{1,14}]*)((?:-\w+)*)""".r
+
+ val gpgVersion: Long = versionLine.split(" ").last match {
+ case TaggedVersion(m, _, _) ⇒ m.toLong
+ case _ ⇒ 0L
+ }
+
+ // https://dev.gnupg.org/T2313
+ val importCommand = if (gpgVersion < 2L) "--import" else "--batch --import"
+
+ val secret = sys.env("PGP_SECRET")
+
+ (s"echo $secret" #| "base64 --decode" #| s"gpg $importCommand").!
+ }
+
+ private def gitHubScmInfo(user: String, repo: String) =
+ ScmInfo(
+ url(s"https://github.com/$user/$repo"),
+ s"scm:git:https://github.com/$user/$repo.git",
+ Some(s"scm:git:git@github.com:$user/$repo.git")
+ )
+
+ override lazy val buildSettings: Seq[Def.Setting[_]] = List(
+ scmInfo ~= {
+ case Some(info) ⇒ Some(info)
+ case None ⇒ {
+ import scala.sys.process._
+ val identifier = """([^\/]+?)"""
+ val GitHubHttps = s"https://github.com/$identifier/$identifier(?:\\.git)?".r
+ val GitHubGit = s"git://github.com:$identifier/$identifier(?:\\.git)?".r
+ val GitHubSsh = s"git@github.com:$identifier/$identifier(?:\\.git)?".r
+ try {
+ val remote = List("git", "ls-remote", "--get-url", "origin").!!.trim()
+ remote match {
+ case GitHubHttps(user, repo) ⇒ Some(gitHubScmInfo(user, repo))
+ case GitHubGit(user, repo) ⇒ Some(gitHubScmInfo(user, repo))
+ case GitHubSsh(user, repo) ⇒ Some(gitHubScmInfo(user, repo))
+ case _ ⇒ None
+ }
+ } catch {
+ case NonFatal(_) ⇒ None
+ }
+ }
+ }
+ )
+
+ override lazy val globalSettings: Seq[Def.Setting[_]] = List(
+ publishArtifact.in(Test) := false,
+ publishMavenStyle := true,
+ commands += Command.command("ci-publish")(currentState ⇒ {
+ if (!isSecure) {
+ println("No access to secret variables, skipping publish")
+ currentState
+ } else {
+ println("Running ci-publish")
+ setupGpg()
+ // https://github.com/olafurpg/sbt-ci-release/issues/64
+
+ "set pgpSecretRing := pgpSecretRing.value" ::
+ "set pgpPublicRing := pgpPublicRing.value" ::
+ "+publishSigned" ::
+ "sonatypeBundleRelease" ::
+ currentState
+ }
+ })
+ )
+
+ override lazy val projectSettings: Seq[Def.Setting[_]] = List(
+ publishConfiguration := publishConfiguration.value.withOverwrite(true),
+ publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true),
+ publishTo := sonatypePublishToBundle.value
+ )
+}
diff --git a/project/build.properties b/project/build.properties
new file mode 100644
index 0000000..0b1f81e
--- /dev/null
+++ b/project/build.properties
@@ -0,0 +1,2 @@
+sbt.version=1.4.8
+
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 2a27408..eab64a1 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -1,5 +1,3 @@
-resolvers ++= Seq( "bintray-sbt-plugin-releases" at "http://dl.bintray.com/content/sbt/sbt-plugin-releases" )
-
-addSbtPlugin("me.lessis" % "bintray-sbt" % "0.1.1")
-
-addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
\ No newline at end of file
+addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2")
+addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
+addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
diff --git a/src/main/scala/io/shaka/jetty/Handlers.scala b/src/main/scala/io/shaka/jetty/Handlers.scala
index db8df26..451022d 100644
--- a/src/main/scala/io/shaka/jetty/Handlers.scala
+++ b/src/main/scala/io/shaka/jetty/Handlers.scala
@@ -1,7 +1,8 @@
package io.shaka.jetty
-import javax.servlet.http.{HttpServletRequest, HttpServletResponse}
+import scala.language.postfixOps
+import javax.servlet.http.{HttpServletRequest, HttpServletResponse}
import io.shaka.http.Http.HttpHandler
import io.shaka.http.HttpHeader.httpHeader
import io.shaka.http.Method.method
diff --git a/src/test/scala/io/shaka/jetty/EmbeddedJettyLoggingSpec.scala b/src/test/scala/io/shaka/jetty/EmbeddedJettyLoggingSpec.scala
index ffbc3ac..76affb5 100644
--- a/src/test/scala/io/shaka/jetty/EmbeddedJettyLoggingSpec.scala
+++ b/src/test/scala/io/shaka/jetty/EmbeddedJettyLoggingSpec.scala
@@ -12,7 +12,7 @@ import scala.collection.mutable
class EmbeddedJettyLoggingSpec extends FunSuite {
test("Override the logging") {
- val logMessages = mutable.MutableList[String]()
+ val logMessages = mutable.ListBuffer[String]()
val logSpy: ToLog = (message) ⇒ logMessages += message
@@ -25,7 +25,7 @@ class EmbeddedJettyLoggingSpec extends FunSuite {
}
test("Override the request logging") {
- val logMessages = mutable.MutableList[String]()
+ val logMessages = mutable.ListBuffer[String]()
val requestLogSpy: RequestLog = new AbstractNCSARequestLog {
override def isEnabled = true