Skip to content

Commit

Permalink
Publish release over Sonatype repository. (playframework#217)
Browse files Browse the repository at this point in the history
Co-authored-by: Renato Cavalcanti <renato@cavalcanti.be>
  • Loading branch information
felipebonezi and octonato committed May 25, 2021
1 parent 58b3652 commit b191fd2
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 70 deletions.
19 changes: 12 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,22 @@ env:
- TRAVIS_JDK=11

before_install:
- curl -sL https://raw.githubusercontent.com/shyiko/jabba/0.11.2/install.sh | bash && . ~/.jabba/jabba.sh
- curl -Ls https://raw.githubusercontent.com/shyiko/jabba/0.11.2/install.sh | JABBA_VERSION=0.11.2 bash && . ~/.jabba/jabba.sh
# Travis-CI has (as of March 2021, anyway) an outdated sbt-extras version,
# so overwrite it with a March 2021 version that works with sbt 1.4.8+
- |
curl -sL https://raw.githubusercontent.com/paulp/sbt-extras/dc4f350f112580fcdf5f6fa7e8d5d2116475f84a/sbt > /tmp/sbt-launch-script || travis_terminate 1
chmod +x /tmp/sbt-launch-script || travis_terminate 1
sudo mv /tmp/sbt-launch-script /usr/local/bin/sbt || travis_terminate 1
install:
- jabba install $(jabba ls-remote "adopt@~1.$TRAVIS_JDK.0-0" --latest=patch) && jabba use "$_" && java -Xmx32m -version
install: jabba install "adopt@~1.$TRAVIS_JDK.0-0" && jabba use "$_" && java -Xmx32m -version

stages:
- name: validate
- name: docs
- name: jacoco
- name: test
- name: deploy
- name: release
if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork

jobs:
Expand Down Expand Up @@ -52,9 +57,9 @@ jobs:
name: "Test plugins JDK11"
env: TRAVIS_JDK=11

- stage: deploy
name: "Publish artifacts to Bintray"
script: sbt +publish
- stage: release
name: "Publish artifacts to Sonatype"
script: sbt ci-release
env: TRAVIS_JDK=8

after_success: bash <(curl -s https://codecov.io/bash)
Expand Down
21 changes: 11 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# Releasing

This is released from the `master` branch unless it is a version older than `6.1.0`. If there is no
branch for the release that needs patching, create it from the tag.
This is released from the `master` branch unless it is a version older than `6.1.0`. If there is no branch for the
release that needs patching, create it from the tag.

## Cutting the release

### Requires contributor access

- Check the [draft release notes](https://github.com/playframework/play-ebean/releases) to see if everything is there
- Wait until [master build finished](https://travis-ci.com/github/playframework/play-ebean/builds) after merging the last PR
- Update the [draft release](https://github.com/playframework/play-ebean/releases) with the next tag version (eg. `7.0.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/play-ebean/builds)
for the new tag and publish artifacts to Bintray)
- Wait until [master build finished](https://travis-ci.com/github/playframework/play-ebean/builds) after merging the
last PR
- Update the [draft release](https://github.com/playframework/play-ebean/releases) with the next tag version
(eg. `7.0.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/play-ebean/builds)
for the new tag and publish artifacts to Sonatype)

### Requires Bintray access
### Requires Sonatype access

- Go to [Bintray](https://bintray.com/playframework/maven/play-ebean) 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))
- Release the staging repos at https://oss.sonatype.org/#stagingRepositories

### Check Maven Central

Expand Down
62 changes: 44 additions & 18 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Dependencies.ScalaVersions.{scala212, scala213}
import Dependencies.ScalaVersions.scala212
import Dependencies.ScalaVersions.scala213
import Dependencies.Versions
import sbt.Append.appendSeq
import xsbti.compile.CompileAnalysis
Expand All @@ -20,7 +21,7 @@ Global / onLoad := (Global / onLoad).value.andThen { s =>
lazy val mimaSettings = Seq(
mimaPreviousArtifacts := Set(
organization.value %% name.value % "6.0.0" //previousStableVersion.value
//.getOrElse(throw new Error("Unable to determine previous version"))
//.getOrElse(throw new Error("Unable to determine previous version"))
),
)

Expand All @@ -36,7 +37,6 @@ lazy val root = project

lazy val core = project
.in(file("play-ebean"))
.enablePlugins(PublishLibrary)
.settings(
name := "play-ebean",
crossScalaVersions := Seq(scala212, scala213),
Expand All @@ -48,12 +48,18 @@ lazy val core = project
(classDirectory in Compile).value,
"play/db/ebean/**"
),
jacocoReportSettings := JacocoReportSettings("Jacoco Coverage Report", None, JacocoThresholds(), Seq(JacocoReportFormats.XML), "utf-8")
jacocoReportSettings := JacocoReportSettings(
"Jacoco Coverage Report",
None,
JacocoThresholds(),
Seq(JacocoReportFormats.XML),
"utf-8"
)
)

lazy val plugin = project
.in(file("sbt-play-ebean"))
.enablePlugins(SbtPlugin, PublishSbtPlugin)
.enablePlugins(SbtPlugin)
.disablePlugins(MimaPlugin)
.settings(
name := "sbt-play-ebean",
Expand All @@ -72,27 +78,47 @@ lazy val plugin = project
)

def sbtPluginDep(moduleId: ModuleID, sbtVersion: String, scalaVersion: String) = {
Defaults.sbtPluginExtra(moduleId, CrossVersion.binarySbtVersion(sbtVersion), CrossVersion.binaryScalaVersion(scalaVersion))
Defaults.sbtPluginExtra(
moduleId,
CrossVersion.binarySbtVersion(sbtVersion),
CrossVersion.binaryScalaVersion(scalaVersion)
)
}

// Ebean enhancement
def enhanceEbeanClasses(classpath: Classpath, analysis: CompileAnalysis, classDirectory: File, pkg: String): CompileAnalysis = {
def enhanceEbeanClasses(
classpath: Classpath,
analysis: CompileAnalysis,
classDirectory: File,
pkg: String
): CompileAnalysis = {
// Ebean (really hacky sorry)
val cp = classpath.map(_.data.toURI.toURL).toArray :+ classDirectory.toURI.toURL
val cl = new java.net.URLClassLoader(cp)
val t = cl.loadClass("io.ebean.enhance.Transformer").getConstructor(classOf[ClassLoader], classOf[String]).newInstance(cl, "debug=0").asInstanceOf[AnyRef]
val ft = cl.loadClass("io.ebean.enhance.ant.OfflineFileTransform").getConstructor(
t.getClass, classOf[ClassLoader], classOf[String]
).newInstance(t, ClassLoader.getSystemClassLoader, classDirectory.getAbsolutePath).asInstanceOf[AnyRef]
val t = cl
.loadClass("io.ebean.enhance.Transformer")
.getConstructor(classOf[ClassLoader], classOf[String])
.newInstance(cl, "debug=0")
.asInstanceOf[AnyRef]
val ft = cl
.loadClass("io.ebean.enhance.ant.OfflineFileTransform")
.getConstructor(
t.getClass,
classOf[ClassLoader],
classOf[String]
)
.newInstance(t, ClassLoader.getSystemClassLoader, classDirectory.getAbsolutePath)
.asInstanceOf[AnyRef]
ft.getClass.getDeclaredMethod("process", classOf[String]).invoke(ft, pkg)
analysis
}

// Version file
def generateVersionFile = Def.task {
val version = (Keys.version in core).value
val file = (resourceManaged in Compile).value / "play-ebean.version.properties"
val content = s"play-ebean.version=$version"
IO.write(file, content)
Seq(file)
}
def generateVersionFile =
Def.task {
val version = (Keys.version in core).value
val file = (resourceManaged in Compile).value / "play-ebean.version.properties"
val content = s"play-ebean.version=$version"
IO.write(file, content)
Seq(file)
}
30 changes: 0 additions & 30 deletions project/Publish.scala

This file was deleted.

4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.2.0")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.8.1")

addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.6.1")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")

addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")

addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
3 changes: 0 additions & 3 deletions sbt-play-ebean/src/sbt-test/sbt-ebean/enhancement/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@ javaSource in Test := baseDirectory.value / "tests"
resolvers ++= DefaultOptions.resolvers(snapshot = true)

libraryDependencies += "com.h2database" % "h2" % "1.4.196"

resolvers += "scalaz-releases" at "https://dl.bintray.com/scalaz/releases" // specs2 depends on scalaz-stream

0 comments on commit b191fd2

Please sign in to comment.