From ae8b3a789a0adf751128610b97437844225674a5 Mon Sep 17 00:00:00 2001 From: Seth Tisue Date: Tue, 27 Jul 2021 20:23:53 -0700 Subject: [PATCH] publishing: bye Bintray, hello Sonatype modeled after playframework/play-json#603 --- .travis.yml | 19 +++++++------------ RELEASING.md | 7 +------ build.sbt | 10 ++++++---- project/Common.scala | 6 ------ project/Publish.scala | 42 ------------------------------------------ project/plugins.sbt | 7 ++----- 6 files changed, 16 insertions(+), 75 deletions(-) delete mode 100644 project/Publish.scala diff --git a/.travis.yml b/.travis.yml index d88a41b7..15efbb1a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,12 +10,6 @@ env: matrix: - ADOPTOPENJDK=11 - global: - # encrypt with: travis encrypt --pro BINTRAY_USER=... - - secure: "TV8cmq1UrtAmwxpaZTI89qEu+kYFgDqRJ2pm2F8TG75TmPWMUZ8YycYld8wWn2dMOXMc5mpDUYYXiJpqnxxiF90lYdCzN/TIJlLGEsHthXSS9UTHyqrCAh5JyT0XiQZmjP+6oCmWJLpdDayrgyTRqQNkUSFboEqN25aXJuCkCDw=" - # encrypt with: travis encrypt --pro BINTRAY_PASS=... - - secure: "XHaF/fAX2H78Bc/5+nyQkSYLQfRX17SP4xBjF15iTxr9v9F2P0KxqsZ4qng2xHaQeUN122iXssOaZviQo4W+Z/o9FqoLXuUq9ukMol48RCFQjJXXnNNmdLmivetOJXOogAu9hHcRTeOoZ197RovIKbgnHIiavicsA3HMPNtm/bw=" - jobs: include: - stage: test @@ -50,16 +44,17 @@ jobs: script: scripts/validate-docs.sh name: "Validate documentation" - - stage: publish - name: "Publish artifacts to Bintray" - script: sbt +publish + - stage: release + name: "Release artifacts to Sonatype" + script: sbt ci-release + env: + - ADOPTOPENJDK=8 stages: - name: test - name: docs - - name: publish - # Snapshots from Bintray are picked up by a scheduled build on Lightbend's Vegemite - if: ((branch = main AND type = push) OR (tag IS present)) AND NOT fork + - name: release + if: tag IS present notifications: webhooks: diff --git a/RELEASING.md b/RELEASING.md index 58884a54..26611e64 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -9,12 +9,7 @@ This is released from the `main` branch from `1.6.0` forward. Unless an older ve - Check the [draft release notes](https://github.com/playframework/twirl/releases) to see if everything is there - Wait until [main build finished](https://travis-ci.com/github/playframework/twirl/builds) after merging the last PR - Update the [draft release](https://github.com/playframework/twirl/releases) with the next tag version (eg. `1.6.0`), title and release description -- Check that Travis CI release build has executed successfully (Travis will start a [CI build](https://travis-ci.com/github/playframework/twirl/builds) for the new tag and publish artifacts to Bintray) - -### Requires Bintray access - -- Go to [Bintray](https://bintray.com/playframework/maven/twirl) and select the just released version -- Go to the Maven Central tab and sync with Sonatype (using your Sonatype TOKEN key and password) (you may watch progress in the [Staging repository](https://oss.sonatype.org/#stagingRepositories)) +- Check that Travis CI release build has executed successfully (Travis will start a [CI build](https://travis-ci.com/github/playframework/twirl/builds) for the new tag and publish artifacts to Sonatype) ### Check Maven Central diff --git a/build.sbt b/build.sbt index 4f95c273..042e9b63 100644 --- a/build.sbt +++ b/build.sbt @@ -16,6 +16,8 @@ val mimaSettings = Seq( mimaPreviousArtifacts := previousVersion.map(organization.value %% name.value % _).toSet ) +ThisBuild / sonatypeProfileName := "com.typesafe" + // Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed ThisBuild / dynverTagPrefix := "" @@ -48,7 +50,7 @@ lazy val nodeJs = { lazy val api = crossProject(JVMPlatform, JSPlatform) .in(file("api")) - .enablePlugins(Common, Playdoc, Omnidoc, PublishLibrary) + .enablePlugins(Common, Playdoc, Omnidoc) .configs(Docs) .settings( mimaSettings, @@ -71,7 +73,7 @@ lazy val apiJs = api.js lazy val parser = project .in(file("parser")) - .enablePlugins(Common, Omnidoc, PublishLibrary) + .enablePlugins(Common, Omnidoc) .settings( mimaSettings, name := "twirl-parser", @@ -82,7 +84,7 @@ lazy val parser = project lazy val compiler = project .in(file("compiler")) - .enablePlugins(Common, Omnidoc, PublishLibrary) + .enablePlugins(Common, Omnidoc) .dependsOn(apiJvm, parser % "compile;test->test") .settings( mimaSettings, @@ -94,7 +96,7 @@ lazy val compiler = project lazy val plugin = project .in(file("sbt-twirl")) - .enablePlugins(PublishSbtPlugin, SbtPlugin) + .enablePlugins(SbtPlugin) .dependsOn(compiler) .settings( name := "sbt-twirl", diff --git a/project/Common.scala b/project/Common.scala index ef35f57c..21c66d09 100644 --- a/project/Common.scala +++ b/project/Common.scala @@ -48,12 +48,6 @@ object Common extends AutoPlugin { crossScalaVersions := ScalaVersions, scalacOptions ++= scalacParameters, javacOptions ++= javacParameters, - scmInfo := Some( - ScmInfo( - url(s"https://github.com/playframework/${repoName}"), - s"scm:git:git@github.com:playframework/${repoName}.git" - ) - ), developers += Developer( "contributors", "Contributors", diff --git a/project/Publish.scala b/project/Publish.scala deleted file mode 100644 index 6c0c9c01..00000000 --- a/project/Publish.scala +++ /dev/null @@ -1,42 +0,0 @@ -import sbt.Keys._ -import sbt._ - -class Publish(isLibrary: Boolean) extends AutoPlugin { - - import bintray.BintrayPlugin - import bintray.BintrayPlugin.autoImport._ - - override def trigger = noTrigger - - override def requires = BintrayPlugin - - val (releaseRepo, snapshotRepo) = - if (isLibrary) - ("maven", "snapshots") - else - ("sbt-plugin-releases", "sbt-plugin-snapshots") - - override def projectSettings = - Seq( - bintrayOrganization := Some("playframework"), - bintrayRepository := (if (isSnapshot.value) snapshotRepo else releaseRepo), - bintrayPackage := "twirl", - // maven style should only be used for libraries, not for plugins - publishMavenStyle := isLibrary, - bintrayPackageLabels := { - val labels = Seq("playframework", "twirl") - if (isLibrary) labels - else labels :+ "plugin" - } - ) -} - -object PublishLibrary extends Publish(isLibrary = true) - -object PublishSbtPlugin extends Publish(isLibrary = false) { - import sbt.ScriptedPlugin.autoImport._ - override def projectSettings = - super.projectSettings ++ Seq( - scriptedLaunchOpts += version.apply { v => s"-Dproject.version=$v" }.value - ) -} diff --git a/project/plugins.sbt b/project/plugins.sbt index 9dc96f6b..ce3903af 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,12 +1,9 @@ -addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.6.1") +addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") // For the Cross Build -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.6.0") - +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.6.0") addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.9.2") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3") - -addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")