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

build: Akka 2.9.3-M3 and publish to Akka repo #1062

Merged
merged 1 commit into from
Oct 10, 2023
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ jobs:
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: sbt ci-release
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}
run: sbt +publishSigned

documentation:
# runs on main repo only
Expand Down
10 changes: 9 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import com.typesafe.sbt.packager.docker._
import com.geirsson.CiReleasePlugin

ThisBuild / resolvers += "Akka library repository".at("https://repo.akka.io/maven")
ThisBuild / resolvers ++= {
if (System.getProperty("override.akka.version") != null)
Seq("Akka Snapshots".at("https://oss.sonatype.org/content/repositories/snapshots/"))
Expand All @@ -8,11 +10,13 @@ ThisBuild / resolvers ++= {

// make version compatible with docker for publishing example project
ThisBuild / dynverSeparator := "-"
// append -SNAPSHOT to version when isSnapshot
ThisBuild / dynverSonatypeSnapshots := true

lazy val root = project
.in(file("."))
.enablePlugins(Common, ScalaUnidocPlugin)
.disablePlugins(SitePlugin)
.disablePlugins(SitePlugin, CiReleasePlugin)
.aggregate(core)
.settings(name := "akka-persistence-cassandra-root", publish / skip := true)

Expand All @@ -22,6 +26,7 @@ dumpSchema := (core / Test / runMain).toTask(" akka.persistence.cassandra.PrintC
lazy val core = project
.in(file("core"))
.enablePlugins(Common, AutomateHeaderPlugin)
.disablePlugins(CiReleasePlugin)
.settings(
name := "akka-persistence-cassandra",
libraryDependencies ++= Dependencies.akkaPersistenceCassandraDependencies,
Expand Down Expand Up @@ -50,14 +55,17 @@ lazy val endToEndExample = project
// Docker image is only for running in k8s
Universal / javaOptions ++= Seq("-J-Dconfig.resource=kubernetes.conf"))
.enablePlugins(DockerPlugin, JavaAppPackaging)
.disablePlugins(CiReleasePlugin)

lazy val dseTest = project
.in(file("dse-test"))
.dependsOn(core % "test->test")
.settings(libraryDependencies ++= Dependencies.dseTestDependencies)
.disablePlugins(CiReleasePlugin)

lazy val docs = project
.enablePlugins(Common, AkkaParadoxPlugin, ParadoxSitePlugin, PreprocessPlugin, PublishRsyncPlugin)
.disablePlugins(CiReleasePlugin)
.dependsOn(core)
.settings(
name := "Akka Persistence Cassandra",
Expand Down
6 changes: 3 additions & 3 deletions docs/release-train-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Variables to be expanded in this template:
- [ ] Make sure all important PRs have been merged
- [ ] Wait until [main build finished](https://github.com/akka/akka-persistence-cassandra/actions) after merging the latest PR
- [ ] Update the [draft release](https://github.com/akka/akka-persistence-cassandra/releases) with the next tag version `v$VERSION$`, title and release description. Use the `Publish release` button, which will create the tag.
- [ ] Check that GitHub Actions release build has executed successfully (GitHub Actions will start a [CI build](https://github.com/akka/akka-persistence-cassandra/actions) for the new tag and publish artifacts to Maven central via Sonatype)
- [ ] Check that GitHub Actions release build has executed successfully (GitHub Actions will start a [CI build](https://github.com/akka/akka-persistence-cassandra/actions) for the new tag and publish artifacts to https://repo.akka.io/maven)

### Check availability

- [ ] Check [API](https://doc.akka.io/api/akka-persistence-cassandra/$VERSION$/) documentation
- [ ] Check [reference](https://doc.akka.io/docs/akka-persistence-cassandra/$VERSION$/) documentation. Check that the reference docs were deployed and show a version warning (see section below on how to fix the version warning).
- [ ] Check the release on [Maven central](https://repo1.maven.org/maven2/com/typesafe/akka/akka-persistence-cassandra_2.13/$VERSION$/)
- [ ] Check the release on https://repo.akka.io/maven/com/typesafe/akka/akka-persistence-cassandra_2.13/$VERSION$/akka-persistence-cassandra_2.13-$VERSION$.pom

### When everything is on maven central
### When everything is on https://repo.akka.io/maven
- [ ] Log into `gustav.akka.io` as `akkarepo`
- [ ] If this updates the `current` version, run `./update-akka-persistence-cassandra-current-version.sh $VERSION$`
- [ ] otherwise check changes and commit the new version to the local git repository
Expand Down
2 changes: 0 additions & 2 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import org.scalafmt.sbt.ScalafmtPlugin.autoImport._
import sbt.Keys._
import sbt._
import sbt.plugins.JvmPlugin
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName

object Common extends AutoPlugin {

Expand Down Expand Up @@ -88,7 +87,6 @@ object Common extends AutoPlugin {
apiURL := Some(url(s"https://doc.akka.io/api/akka-persistence-cassandra/${projectInfoVersion.value}")),
headerLicense := Some(
HeaderLicense.Custom("""Copyright (C) 2016-2023 Lightbend Inc. <https://www.lightbend.com>""")),
sonatypeProfileName := "com.typesafe",
Test / logBuffered := System.getProperty("akka.logBufferedTests", "false").toBoolean,
// show full stack traces and test case durations
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oDF"),
Expand Down
8 changes: 4 additions & 4 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ object Dependencies {
val Scala2Versions = Seq(Scala213)
val ScalaVersions = Dependencies.Scala2Versions :+ Dependencies.Scala3

val AkkaVersion = System.getProperty("override.akka.version", "2.7.0")
val AkkaVersion = System.getProperty("override.akka.version", "2.9.0-M3")
val AkkaVersionInDocs = AkkaVersion.take(3)
val CassandraVersionInDocs = "4.0"
// Should be sync with the version of the driver in Alpakka Cassandra
val CassandraDriverVersion = "4.17.0"
val DriverVersionInDocs = "4.14"

val AlpakkaVersion = "6.0.0"
val AlpakkaVersionInDocs = AlpakkaVersion
val AlpakkaVersion = "7.0.0-M2"
val AlpakkaVersionInDocs = "7.0"
// for example
val AkkaManagementVersion = "1.2.0"
val AkkaManagementVersion = "1.5.0-M1"

val Logback = "ch.qos.logback" % "logback-classic" % "1.2.12"

Expand Down
63 changes: 63 additions & 0 deletions project/Publish.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com>
*/

import java.util.concurrent.atomic.AtomicBoolean

import scala.language.postfixOps

import sbt.{ Def, _ }
import Keys._
import com.geirsson.CiReleasePlugin
import com.jsuereth.sbtpgp.PgpKeys.publishSigned
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName

/**
* For projects that are not published.
*/
object NoPublish extends AutoPlugin {
override def requires = plugins.JvmPlugin

override def projectSettings =
Seq(publish / skip := true, publishArtifact := false, publish := {}, publishLocal := {})
}

object Publish extends AutoPlugin {
override def requires = plugins.JvmPlugin && Common
override def trigger = AllRequirements

lazy val beforePublishTask = taskKey[Unit]("setup before publish")

lazy val beforePublishDone = new AtomicBoolean(false)

def beforePublish(snapshot: Boolean) = {
if (beforePublishDone.compareAndSet(false, true)) {
CiReleasePlugin.setupGpg()
if (!snapshot)
cloudsmithCredentials(validate = true)
}
}

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
sonatypeProfileName := "com.typesafe",
beforePublishTask := beforePublish(isSnapshot.value),
publishSigned := publishSigned.dependsOn(beforePublishTask).value,
publishTo := (if (isSnapshot.value)
Some(Resolver.file("file", target.value / "repository")) // FIXME snapshot repo
else
Some("Cloudsmith API".at("https://maven.cloudsmith.io/lightbend/akka/"))),
credentials ++= (if (isSnapshot.value) Seq[Credentials]() else cloudsmithCredentials(validate = false)))

def cloudsmithCredentials(validate: Boolean): Seq[Credentials] = {
(sys.env.get("PUBLISH_USER"), sys.env.get("PUBLISH_PASSWORD")) match {
case (Some(user), Some(password)) =>
Seq(Credentials("Cloudsmith API", "maven.cloudsmith.io", user, password))
case _ =>
if (validate)
throw new Exception("Publishing credentials expected in `PUBLISH_USER` and `PUBLISH_PASSWORD`.")
else
Nil
}
}
}
Loading