Skip to content

Commit f7a1e15

Browse files
authored
build: Akka 2.9.3-M3 and publish to Akka repo (#773)
1 parent c806767 commit f7a1e15

File tree

6 files changed

+80
-17
lines changed

6 files changed

+80
-17
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
- name: Publish artifacts for all Scala versions
4444
env:
4545
PGP_SECRET: ${{ secrets.PGP_SECRET }}
46-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
47-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
48-
run: sbt ci-release
46+
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
47+
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}
48+
run: sbt +publishSigned
4949

5050
documentation:
5151
# runs on main repo only

build.sbt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import com.lightbend.paradox.apidoc.ApidocPlugin.autoImport.apidocRootPackage
2+
import com.geirsson.CiReleasePlugin
23

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

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

1313
lazy val core = project
1414
.in(file("core"))
1515
.enablePlugins(MimaPlugin)
16-
.disablePlugins(SitePlugin)
16+
.disablePlugins(SitePlugin, CiReleasePlugin)
1717
.configs(IntegrationTest.extend(Test))
1818
.settings(Defaults.itSettings)
1919
.settings(
@@ -26,7 +26,7 @@ lazy val core = project
2626

2727
lazy val migrator = project
2828
.in(file("migrator"))
29-
.disablePlugins(SitePlugin, MimaPlugin)
29+
.disablePlugins(SitePlugin, MimaPlugin, CiReleasePlugin)
3030
.configs(IntegrationTest.extend(Test))
3131
.settings(Defaults.itSettings)
3232
.settings(
@@ -38,7 +38,7 @@ lazy val migrator = project
3838

3939
lazy val docs = project
4040
.enablePlugins(ProjectAutoPlugin, AkkaParadoxPlugin, ParadoxSitePlugin, PreprocessPlugin, PublishRsyncPlugin)
41-
.disablePlugins(MimaPlugin)
41+
.disablePlugins(MimaPlugin, CiReleasePlugin)
4242
.settings(
4343
name := "Akka Persistence JDBC",
4444
publish / skip := true,

docs/release-train-issue-template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Key links:
2424
- [ ] 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".
2525
- [ ] Wait until [main build finished](https://github.com/akka/akka-persistence-jdbc/actions) after merging the latest PR
2626
- [ ] 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.
27-
- [ ] 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)
27+
- [ ] 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)
2828

2929
### Check availability
3030

3131
- [ ] Check [API](https://doc.akka.io/api/akka-persistence-jdbc/$VERSION$/) documentation
3232
- [ ] 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).
33-
- [ ] Check the release on [Maven central](https://repo1.maven.org/maven2/com/lightbend/akka/akka-persistence-jdbc_2.13/$VERSION$/)
33+
- [ ] 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
3434

35-
### When everything is on maven central
35+
### When everything is on https://repo.akka.io/maven
3636
- [ ] Log into `gustav.akka.io` as `akkarepo`
3737
- [ ] If this updates the `current` version, run `./update-akka-persistence-jdbc-current-version.sh $VERSION$`
3838
- [ ] otherwise check changes and commit the new version to the local git repository

project/Dependencies.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ object Dependencies {
66

77
val ScalaVersions = Seq(Scala213)
88

9-
val AkkaVersion = "2.7.0"
9+
val AkkaVersion = "2.9.0-M3"
1010
val AkkaBinaryVersion = AkkaVersion.take(3)
1111

1212
val SlickVersion = "3.4.1"

project/ProjectAutoPlugin.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.{ headerLicense, Head
44
import sbt.Keys._
55
import sbt._
66
import sbt.plugins.JvmPlugin
7-
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName
7+
import sbtdynver.DynVerPlugin.autoImport.dynverSonatypeSnapshots
88

99
object ProjectAutoPlugin extends AutoPlugin {
1010
object autoImport {}
1111

12-
override val requires = JvmPlugin && HeaderPlugin && CiReleasePlugin
12+
override val requires = JvmPlugin && HeaderPlugin
1313

1414
override def globalSettings =
1515
Seq(
@@ -43,6 +43,8 @@ object ProjectAutoPlugin extends AutoPlugin {
4343
crossVersion := CrossVersion.binary,
4444
crossScalaVersions := Dependencies.ScalaVersions,
4545
scalaVersion := Dependencies.Scala213,
46+
// append -SNAPSHOT to version when isSnapshot
47+
ThisBuild / dynverSonatypeSnapshots := true,
4648
Test / fork := false,
4749
Test / parallelExecution := false,
4850
Test / logBuffered := true,
@@ -91,8 +93,7 @@ object ProjectAutoPlugin extends AutoPlugin {
9193
headerLicense := Some(HeaderLicense.Custom("""|Copyright (C) 2014 - 2019 Dennis Vriend <https://github.com/dnvriend>
9294
|Copyright (C) 2019 - 2023 Lightbend Inc. <https://www.lightbend.com>
9395
|""".stripMargin)),
94-
resolvers += Resolver.jcenterRepo,
95-
sonatypeProfileName := "com.lightbend")
96+
resolvers += Resolver.jcenterRepo)
9697

9798
val disciplineScalacOptions = Set(
9899
// "-Xfatal-warnings",

project/Publish.scala

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
* Copyright (C) 2023 Lightbend Inc. <https://www.lightbend.com>
3+
*/
4+
5+
import java.util.concurrent.atomic.AtomicBoolean
6+
7+
import scala.language.postfixOps
8+
9+
import sbt.{ Def, _ }
10+
import Keys._
11+
import com.geirsson.CiReleasePlugin
12+
import com.jsuereth.sbtpgp.PgpKeys.publishSigned
13+
import xerial.sbt.Sonatype.autoImport.sonatypeProfileName
14+
15+
/**
16+
* For projects that are not published.
17+
*/
18+
object NoPublish extends AutoPlugin {
19+
override def requires = plugins.JvmPlugin
20+
21+
override def projectSettings =
22+
Seq(publish / skip := true, publishArtifact := false, publish := {}, publishLocal := {})
23+
}
24+
25+
object Publish extends AutoPlugin {
26+
override def requires = plugins.JvmPlugin && ProjectAutoPlugin
27+
override def trigger = AllRequirements
28+
29+
lazy val beforePublishTask = taskKey[Unit]("setup before publish")
30+
31+
lazy val beforePublishDone = new AtomicBoolean(false)
32+
33+
def beforePublish(snapshot: Boolean) = {
34+
if (beforePublishDone.compareAndSet(false, true)) {
35+
CiReleasePlugin.setupGpg()
36+
if (!snapshot)
37+
cloudsmithCredentials(validate = true)
38+
}
39+
}
40+
41+
override def projectSettings: Seq[Def.Setting[_]] = Seq(
42+
sonatypeProfileName := "com.lightbend",
43+
beforePublishTask := beforePublish(isSnapshot.value),
44+
publishSigned := publishSigned.dependsOn(beforePublishTask).value,
45+
publishTo := (if (isSnapshot.value)
46+
Some(Resolver.file("file", target.value / "repository")) // FIXME snapshot repo
47+
else
48+
Some("Cloudsmith API".at("https://maven.cloudsmith.io/lightbend/akka/"))),
49+
credentials ++= (if (isSnapshot.value) Seq[Credentials]() else cloudsmithCredentials(validate = false)))
50+
51+
def cloudsmithCredentials(validate: Boolean): Seq[Credentials] = {
52+
(sys.env.get("PUBLISH_USER"), sys.env.get("PUBLISH_PASSWORD")) match {
53+
case (Some(user), Some(password)) =>
54+
Seq(Credentials("Cloudsmith API", "maven.cloudsmith.io", user, password))
55+
case _ =>
56+
if (validate)
57+
throw new Exception("Publishing credentials expected in `PUBLISH_USER` and `PUBLISH_PASSWORD`.")
58+
else
59+
Nil
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)