Skip to content

Commit

Permalink
Release by tag via sbt-ci-release
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurz committed Dec 11, 2023
1 parent 2aa7e68 commit 140de63
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 69 deletions.
26 changes: 6 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,28 +360,14 @@ Configure your configuration endpoint in `application.conf`:

0.12.0 Built for Play 2.9.0 and Scala 2.13.12 and 3.3.1. Artifact ID for this build is `play2-memcached-play29_[2.13|3]`

### Publishing to the central
### Releasing play2-memcached / Publishing to the maven central

```
# Play 2.5
PLAY_VERSION=2.5.0 sbt ++2.11.12 publishSigned sonatypeRelease
# Play 2.6
PLAY_VERSION=2.6.0 sbt ++2.12.8 publishSigned sonatypeRelease
# Play 2.7
PLAY_VERSION=2.7.3 sbt ++2.11.12 publishSigned sonatypeRelease
PLAY_VERSION=2.7.3 sbt ++2.12.8 publishSigned sonatypeRelease
PLAY_VERSION=2.7.3 sbt ++2.13.0 publishSigned sonatypeRelease
1. Tag the release: `git tag -s 1.2.3`
1. Push tag: `git push upstream 1.2.3`
1. GitHub action workflow does the rest: https://github.com/mumoshu/play2-memcached/actions/workflows/publish.yml
- Snapshots are published to https://oss.sonatype.org/content/repositories/snapshots/com/github/mumoshu/
- Releases are published to https://repo1.maven.org/maven2/com/github/mumoshu/ (takes up to 1 hour)

# Play 2.8
PLAY_VERSION=2.8.0 sbt ++2.12.10 publishSigned sonatypeRelease
PLAY_VERSION=2.8.0 sbt ++2.13.1 publishSigned sonatypeRelease
# Play 2.9
PLAY_VERSION=2.9.0 sbt ++2.13.12 publishSigned sonatypeRelease
PLAY_VERSION=2.9.0 sbt ++3.3.1 publishSigned sonatypeRelease
```

### Acknowledgement

Expand Down
56 changes: 20 additions & 36 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
val appName = "play2-memcached-" + playShortName
val appVersion = "0.12.0-SNAPSHOT"
val spymemcached = "net.spy" % "spymemcached" % "2.12.3"
val h2databaseTest = "com.h2database" % "h2" % "2.2.224" % Test

Expand All @@ -15,11 +14,20 @@ def playShortName: String = {
s"play$majorMinor"
}

// Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed
ThisBuild / dynverVTagPrefix := true

// Sanity-check: assert that version comes from a tag (e.g. not a too-shallow clone)
// https://github.com/dwijnand/sbt-dynver/#sanity-checking-the-version
Global / onLoad := (Global / onLoad).value.andThen { s =>
dynverAssertTagVersion.value
s
}

lazy val root = Project("root", base = file("."))
.settings(baseSettings: _*)
.settings(
publishLocal := {},
publish := {}
publish / skip := true,
).aggregate(plugin, scalaSample, javaSample)

lazy val plugin = Project(appName, base = file("plugin"))
Expand All @@ -31,38 +39,16 @@ lazy val plugin = Project(appName, base = file("plugin"))
libraryDependencies += cacheApi % Provided,
libraryDependencies += specs2 % Test,
organization := "com.github.mumoshu",
version := appVersion,
//scalacOptions += "-deprecation",
publishTo := {
val v = version.value
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
publishMavenStyle := true,
Test / publishArtifact := false,
pomIncludeRepository := { _ => false },
pomExtra := (
<url>https://github.com/mumoshu/play2-memcached</url>
<licenses>
<license>
<name>BSD-style</name>
<url>http://www.opensource.org/licenses/bsd-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:mumoshu/play2-memcached.git</url>
<connection>scm:git:git@github.com:mumoshu/play2-memcached.git</connection>
</scm>
<developers>
<developer>
<id>you</id>
<name>KUOKA Yusuke</name>
<url>https://github.com/mumoshu</url>
</developer>
</developers>
),
licenses := Seq("Apache License" -> url("https://github.com/mumoshu/play2-memcached/blob/main/LICENSE")),
developers += Developer(
"you",
"KUOKA Yusuke",
"you",
url("https://github.com/mumoshu")
),
Compile/ unmanagedSourceDirectories := {
(Compile / unmanagedSourceDirectories).value ++ Seq((Compile / sourceDirectory).value)
},
Expand All @@ -79,8 +65,7 @@ lazy val scalaSample = Project(
.settings(
libraryDependencies += cacheApi,
libraryDependencies += h2databaseTest,
publishLocal := {},
publish := {}
publish / skip := true,
).dependsOn(plugin)

lazy val javaSample = Project(
Expand All @@ -91,6 +76,5 @@ lazy val javaSample = Project(
.settings(
libraryDependencies += cacheApi,
libraryDependencies += h2databaseTest,
publishLocal := {},
publish := {}
publish / skip := true,
).dependsOn(plugin)
8 changes: 2 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
ivyLoggingLevel := UpdateLogging.Full

val playVersion = scala.util.Properties.envOrElse("PLAY_VERSION", "2.9.0")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.0")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % playVersion)

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0")

addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
4 changes: 0 additions & 4 deletions publish.sh

This file was deleted.

3 changes: 0 additions & 3 deletions sonatype.sbt

This file was deleted.

0 comments on commit 140de63

Please sign in to comment.