Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from travis to Github actions + release by tag #79

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check

on:
pull_request:

push:
branches:
- main # Check branch after merge

concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Tests
uses: playframework/.github/.github/workflows/cmd.yml@v3
with:
java: 21, 17, 11
scala: 2.13.x, 3.x
cmd: |
sudo apt-get install -y memcached
sbt ++$MATRIX_SCALA test

finish:
name: Finish
if: github.event_name == 'pull_request'
needs: # Should be last
- "tests"
uses: playframework/.github/.github/workflows/rtm.yml@v3
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish

on:
push:
branches: # Snapshots
- main
tags: ["**"] # Releases

jobs:
publish-artifacts:
name: JDK 11
runs-on: ubuntu-20.04
if: ${{ github.repository_owner == 'mumoshu' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Coursier Cache
id: coursier-cache
uses: coursier/cache-action@v6

- name: Install memcached
run: sudo apt-get install -y memcached

- name: Install Adoptium Temurin OpenJDK
uses: coursier/setup-action@v1
with:
jvm: adoptium:8

- name: Publish artifacts
run: sbt ci-release
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}

- name: Cleanup before cache
shell: bash
run: |
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

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>[email protected]:mumoshu/play2-memcached.git</url>
<connection>scm:git:[email protected]: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.

Loading