Skip to content

Commit

Permalink
build: Akka 2.9.3-M3 and publish to Akka repo (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw authored Oct 9, 2023
1 parent c806767 commit f7a1e15
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 17 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ jobs:
- name: Publish artifacts for all Scala versions
env:
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
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import com.lightbend.paradox.apidoc.ApidocPlugin.autoImport.apidocRootPackage
import com.geirsson.CiReleasePlugin

// FIXME remove switching to final Akka version
ThisBuild / resolvers += "Akka Snapshots".at("https://oss.sonatype.org/content/repositories/snapshots/")
ThisBuild / resolvers += "Akka library repository".at("https://repo.akka.io/maven")

lazy val `akka-persistence-jdbc` = project
.in(file("."))
.enablePlugins(ScalaUnidocPlugin)
.disablePlugins(MimaPlugin, SitePlugin)
.disablePlugins(MimaPlugin, SitePlugin, CiReleasePlugin)
.aggregate(core, docs, migrator)
.settings(publish / skip := true)

lazy val core = project
.in(file("core"))
.enablePlugins(MimaPlugin)
.disablePlugins(SitePlugin)
.disablePlugins(SitePlugin, CiReleasePlugin)
.configs(IntegrationTest.extend(Test))
.settings(Defaults.itSettings)
.settings(
Expand All @@ -26,7 +26,7 @@ lazy val core = project

lazy val migrator = project
.in(file("migrator"))
.disablePlugins(SitePlugin, MimaPlugin)
.disablePlugins(SitePlugin, MimaPlugin, CiReleasePlugin)
.configs(IntegrationTest.extend(Test))
.settings(Defaults.itSettings)
.settings(
Expand All @@ -38,7 +38,7 @@ lazy val migrator = project

lazy val docs = project
.enablePlugins(ProjectAutoPlugin, AkkaParadoxPlugin, ParadoxSitePlugin, PreprocessPlugin, PublishRsyncPlugin)
.disablePlugins(MimaPlugin)
.disablePlugins(MimaPlugin, CiReleasePlugin)
.settings(
name := "Akka Persistence JDBC",
publish / skip := true,
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/akka-persistence-jdbc/actions) after merging the latest PR
- [ ] Update the [draft release](https://github.com/akka/akka-persistence-jdbc/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-jdbc/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-jdbc/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-jdbc/$VERSION$/) documentation
- [ ] Check [reference](https://doc.akka.io/docs/akka-persistence-jdbc/$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/lightbend/akka/akka-persistence-jdbc_2.13/$VERSION$/)
- [ ] Check the release on https://repo.akka.io/maven/com/lightbend/akka/akka-persistence-jdbc_2.13/$VERSION$/akka-persistence-jdbc_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-jdbc-current-version.sh $VERSION$`
- [ ] otherwise check changes and commit the new version to the local git repository
Expand Down
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ object Dependencies {

val ScalaVersions = Seq(Scala213)

val AkkaVersion = "2.7.0"
val AkkaVersion = "2.9.0-M3"
val AkkaBinaryVersion = AkkaVersion.take(3)

val SlickVersion = "3.4.1"
Expand Down
9 changes: 5 additions & 4 deletions project/ProjectAutoPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{ headerLicense, Head
import sbt.Keys._
import sbt._
import sbt.plugins.JvmPlugin
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName
import sbtdynver.DynVerPlugin.autoImport.dynverSonatypeSnapshots

object ProjectAutoPlugin extends AutoPlugin {
object autoImport {}

override val requires = JvmPlugin && HeaderPlugin && CiReleasePlugin
override val requires = JvmPlugin && HeaderPlugin

override def globalSettings =
Seq(
Expand Down Expand Up @@ -43,6 +43,8 @@ object ProjectAutoPlugin extends AutoPlugin {
crossVersion := CrossVersion.binary,
crossScalaVersions := Dependencies.ScalaVersions,
scalaVersion := Dependencies.Scala213,
// append -SNAPSHOT to version when isSnapshot
ThisBuild / dynverSonatypeSnapshots := true,
Test / fork := false,
Test / parallelExecution := false,
Test / logBuffered := true,
Expand Down Expand Up @@ -91,8 +93,7 @@ object ProjectAutoPlugin extends AutoPlugin {
headerLicense := Some(HeaderLicense.Custom("""|Copyright (C) 2014 - 2019 Dennis Vriend <https://github.com/dnvriend>
|Copyright (C) 2019 - 2023 Lightbend Inc. <https://www.lightbend.com>
|""".stripMargin)),
resolvers += Resolver.jcenterRepo,
sonatypeProfileName := "com.lightbend")
resolvers += Resolver.jcenterRepo)

val disciplineScalacOptions = Set(
// "-Xfatal-warnings",
Expand Down
62 changes: 62 additions & 0 deletions project/Publish.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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 && ProjectAutoPlugin
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.lightbend",
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
}
}
}

0 comments on commit f7a1e15

Please sign in to comment.