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 #1681

Merged
merged 2 commits into from
Oct 9, 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/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,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
26 changes: 15 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import com.typesafe.tools.mima.core.{Problem, ProblemFilters}
import com.geirsson.CiReleasePlugin

enablePlugins(AutomateHeaderPlugin)
disablePlugins(CiReleasePlugin)

name := "akka-stream-kafka"

Expand All @@ -15,8 +17,8 @@ val ScalaVersions = Scala2Versions :+ Scala3

val Scala3Settings = Seq(crossScalaVersions := ScalaVersions)

val AkkaBinaryVersionForDocs = "2.7"
val akkaVersion = "2.7.0"
val AkkaBinaryVersionForDocs = "2.9"
val akkaVersion = "2.9.0-M3"

// Keep .scala-steward.conf pin in sync
val kafkaVersion = "3.5.1"
Expand All @@ -38,6 +40,7 @@ val confluentLibsExclusionRules = Seq(
)

ThisBuild / resolvers ++= Seq(
"Akka library repository".at("https://repo.akka.io/maven"),
// for Jupiter interface (JUnit 5)
Resolver.jcenterRepo
)
Expand Down Expand Up @@ -92,6 +95,8 @@ val commonSettings = Def.settings(
crossScalaVersions := Scala2Versions,
scalaVersion := Scala213,
crossVersion := CrossVersion.binary,
// append -SNAPSHOT to version when isSnapshot
ThisBuild / dynverSonatypeSnapshots := true,
javacOptions ++= Seq(
"-Xlint:deprecation",
"-Xlint:unchecked",
Expand Down Expand Up @@ -156,15 +161,14 @@ val commonSettings = Def.settings(
|""".stripMargin
)
),
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value),
sonatypeProfileName := "com.typesafe"
projectInfoVersion := (if (isSnapshot.value) "snapshot" else version.value)
)

lazy val `alpakka-kafka` =
project
.in(file("."))
.enablePlugins(ScalaUnidocPlugin)
.disablePlugins(SitePlugin, MimaPlugin)
.disablePlugins(SitePlugin, MimaPlugin, CiReleasePlugin)
.settings(commonSettings)
.settings(
publish / skip := true,
Expand Down Expand Up @@ -213,7 +217,7 @@ lazy val `alpakka-kafka` =

lazy val core = project
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(SitePlugin)
.disablePlugins(SitePlugin, CiReleasePlugin)
.settings(commonSettings)
.settings(VersionGenerator.settings)
.settings(
Expand All @@ -235,7 +239,7 @@ lazy val core = project
lazy val testkit = project
.dependsOn(core)
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(SitePlugin)
.disablePlugins(SitePlugin, CiReleasePlugin)
.settings(commonSettings)
.settings(
name := "akka-stream-kafka-testkit",
Expand All @@ -260,7 +264,7 @@ lazy val clusterSharding = project
.in(file("./cluster-sharding"))
.dependsOn(core)
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(SitePlugin)
.disablePlugins(SitePlugin, CiReleasePlugin)
.settings(commonSettings)
.settings(
name := "akka-stream-kafka-cluster-sharding",
Expand All @@ -279,7 +283,7 @@ lazy val clusterSharding = project
lazy val tests = project
.dependsOn(core, testkit, clusterSharding)
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(MimaPlugin, SitePlugin)
.disablePlugins(MimaPlugin, SitePlugin, CiReleasePlugin)
.configs(IntegrationTest.extend(Test))
.settings(commonSettings)
.settings(Defaults.itSettings)
Expand Down Expand Up @@ -320,7 +324,7 @@ lazy val tests = project

lazy val docs = project
.enablePlugins(AkkaParadoxPlugin, ParadoxSitePlugin, SitePreviewPlugin, PreprocessPlugin, PublishRsyncPlugin)
.disablePlugins(MimaPlugin)
.disablePlugins(MimaPlugin, CiReleasePlugin)
.settings(commonSettings)
.settings(
name := "Alpakka Kafka",
Expand Down Expand Up @@ -374,7 +378,7 @@ lazy val docs = project
lazy val benchmarks = project
.dependsOn(core, testkit)
.enablePlugins(AutomateHeaderPlugin)
.disablePlugins(MimaPlugin, SitePlugin)
.disablePlugins(MimaPlugin, SitePlugin, CiReleasePlugin)
.configs(IntegrationTest)
.settings(commonSettings)
.settings(Defaults.itSettings)
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 @@ -24,15 +24,15 @@ Key links:
- [ ] Update the revision in Fossa in the Akka Group for the Akka umbrella version, e.g. `22.10`. Note that the revisions for the release is udpated by Akka Group > Projects > Edit. For recent dependency updates the Fossa validation can be triggered from the GitHub actions "Dependency License Scanning".
- [ ] Wait until [main build finished](https://github.com/akka/alpakka-kafka/actions) after merging the latest PR
- [ ] Update the [draft release](https://github.com/akka/alpakka-kafka/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/alpakka-kafka/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/alpakka-kafka/actions) for the new tag and publish artifacts to https://repo.akka.io/maven)

### Check availability

- [ ] Check [API](https://doc.akka.io/api/alpakka-kafka/$VERSION$/) documentation
- [ ] Check [reference](https://doc.akka.io/docs/alpakka-kafka/$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-stream-kafka_2.13/$VERSION$/)
- [ ] Check the release on https://repo.akka.io/maven/com/typesafe/akka/akka-stream-kafka_2.13/$VERSION$/akka-stream-kafka_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-alpakka-kafka-current-version.sh $VERSION$`
- [ ] otherwise check changes and commit the new version to the local git repository
Expand Down
68 changes: 68 additions & 0 deletions project/Publish.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com>
*/
package akka

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
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
}
}
}