Skip to content

Commit

Permalink
build: Akka 2.9.3-M3 and publish to Akka repo (#4319)
Browse files Browse the repository at this point in the history
  • Loading branch information
patriknw authored Oct 6, 2023
1 parent 13d0726 commit 91cb857
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 19 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions:

jobs:
publish-artifacts:
name: Publish artifacts to Sonatype
name: Publish artifacts
runs-on: ubuntu-22.04
steps:
- name: Checkout
Expand All @@ -29,15 +29,14 @@ jobs:
- name: Install graphviz
run: sudo apt-get install -y graphviz

- name: Publish Artifacts to Sonatype / Maven
- name: Publish Artifacts
run: |
sbt ci-release
sbt +publishSigned
env:
CI_SONATYPE_RELEASE: "; sonatypePrepare; sonatypeBundleUpload; sonatypeClose"
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}

publish-docs:
name: Publish documentation
Expand Down
6 changes: 1 addition & 5 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ A few more background information about the process can be found below.

### Release Automation with Github Action

Akka HTTP uses Github Actions and the sbt-ci-release plugin to release artifacts automatically. For commits to the `main` branch, it directly publishes artifacts to the Sonatype snapshot repository.
Tags are published to Maven Central. The process is currently a two-step process:
* Github Actions uses sbt-ci-release to prepare the release and push it to Sonatype, closing the repository at the end.
* At that point a staging repository has been created that can be used to validate artifacts.
* When the release has been validated, the release person needs to manually release the artifacts from staging to Maven Central.
Akka HTTP uses Github Actions and to release artifacts automatically to Akka's library repository. For commits to the `main` branch, it directly publishes artifacts to the Sonatype snapshot repository.

### Releasing only updated docs

Expand Down
13 changes: 12 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ lazy val root = Project(
base = file(".")
)
.enablePlugins(UnidocRoot, NoPublish, PublishRsyncPlugin, AggregatePRValidation, NoScala3)
.disablePlugins(MimaPlugin)
.disablePlugins(
MimaPlugin,
com.geirsson.CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin
.settings(
// Unidoc doesn't like macro definitions
unidocProjectExcludes := Seq(parsing, compatibilityTests, docs, httpTests, httpJmhBench, httpScalafix, httpScalafixRules, httpScalafixTestInput, httpScalafixTestOutput, httpScalafixTests),
Expand Down Expand Up @@ -343,6 +345,7 @@ lazy val httpCaching = project("akka-http-caching")

def project(name: String) =
Project(id = name, base = file(name))
.disablePlugins(com.geirsson.CiReleasePlugin) // we use publishSigned, but use a pgp utility from CiReleasePlugin

def httpMarshallersScalaSubproject(name: String) =
Project(
Expand All @@ -353,6 +356,7 @@ def httpMarshallersScalaSubproject(name: String) =
.settings(commonSettings)
.enablePlugins(BootstrapGenjavadoc)
.enablePlugins(ReproducibleBuildsPlugin)
.disablePlugins(com.geirsson.CiReleasePlugin)

def httpMarshallersJavaSubproject(name: String) =
Project(
Expand All @@ -363,6 +367,7 @@ def httpMarshallersJavaSubproject(name: String) =
.settings(commonSettings)
.enablePlugins(BootstrapGenjavadoc)
.enablePlugins(ReproducibleBuildsPlugin)
.disablePlugins(com.geirsson.CiReleasePlugin)

lazy val httpScalafix = project("akka-http-scalafix")
.enablePlugins(NoPublish, NoScala3)
Expand All @@ -376,13 +381,15 @@ lazy val httpScalafixRules =
)
.enablePlugins(NoScala3)
.disablePlugins(MimaPlugin) // tooling, no bin compat guaranteed
.disablePlugins(com.geirsson.CiReleasePlugin)

lazy val httpScalafixTestInput =
Project(id = "akka-http-scalafix-test-input", base = file("akka-http-scalafix/scalafix-test-input"))
.dependsOn(http)
.addAkkaModuleDependency("akka-stream")
.enablePlugins(NoPublish, NoScala3)
.disablePlugins(MimaPlugin, HeaderPlugin /* because it gets confused about metaheader required for tests */)
.disablePlugins(com.geirsson.CiReleasePlugin)
.settings(
addCompilerPlugin(scalafixSemanticdb),
scalacOptions ++= List(
Expand All @@ -398,11 +405,13 @@ lazy val httpScalafixTestOutput =
.addAkkaModuleDependency("akka-stream")
.enablePlugins(NoPublish, NoScala3)
.disablePlugins(MimaPlugin, HeaderPlugin /* because it gets confused about metaheader required for tests */)
.disablePlugins(com.geirsson.CiReleasePlugin)

lazy val httpScalafixTests =
Project(id = "akka-http-scalafix-tests", base = file("akka-http-scalafix/scalafix-tests"))
.enablePlugins(NoPublish, NoScala3)
.disablePlugins(MimaPlugin)
.disablePlugins(com.geirsson.CiReleasePlugin)
.settings(
publish / skip := true,
libraryDependencies += "ch.epfl.scala" % "scalafix-testkit" % Dependencies.scalafixVersion % Test cross CrossVersion.full,
Expand Down Expand Up @@ -499,6 +508,7 @@ lazy val docs = project("docs")
lazy val compatibilityTests = Project("akka-http-compatibility-tests", file("akka-http-compatibility-tests"))
.enablePlugins(NoPublish)
.disablePlugins(MimaPlugin)
.disablePlugins(com.geirsson.CiReleasePlugin)
.addAkkaModuleDependency("akka-stream", "provided")
.settings(
libraryDependencies +=(
Expand All @@ -518,6 +528,7 @@ lazy val compatibilityTests = Project("akka-http-compatibility-tests", file("akk
lazy val billOfMaterials = Project("bill-of-materials", file("akka-http-bill-of-materials"))
.enablePlugins(BillOfMaterialsPlugin)
.disablePlugins(MimaPlugin)
.disablePlugins(com.geirsson.CiReleasePlugin)
.settings(
name := "akka-http-bom",
bomIncludeProjects := userProjects,
Expand Down
8 changes: 3 additions & 5 deletions docs/release-train-issue-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,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-http/actions) after merging the latest PR
- [ ] Update the [draft release](https://github.com/akka/akka-http/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-http/actions) for the new tag and publish artifacts to Maven central via Sonatype)
- [ ] Run a test against the staging repository to make sure the release went well, for example by using https://github.com/akka/akka-http-quickstart-scala.g8 and adding the sonatype staging repo with `resolvers += "Staging Repo" at "https://oss.sonatype.org/content/repositories/staging"`
- [ ] Release the staging repository to Maven Central.
- [ ] Check that GitHub Actions release build has executed successfully (GitHub Actions will start a [CI build](https://github.com/akka/akka-http/actions) for the new tag and publish artifacts to https://repo.akka.io/maven)

### Check availability

- [ ] Check [API](https://doc.akka.io/api/akka-http/$VERSION$/) documentation
- [ ] Check [reference](https://doc.akka.io/docs/akka-http/$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-http-core_2.13/$VERSION$/
- [ ] Check the release on https://repo.akka.io/maven/com/typesafe/akka/akka-http-core_2.13/$VERSION$/

### 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-http-current-version.sh $VERSION$`
- [ ] otherwise check changes and commit the new version to the local git repository
Expand Down
10 changes: 10 additions & 0 deletions docs/src/main/paradox/migration-guide/migration-guide-10.6.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ using HTTP/2.

The typesafe-ssl-config dependency and deprecated APIs accepting the types from it has been dropped.

## Akka repository

The Akka dependencies are available from Akka's library repository. To access them there, you need to configure the URL for this repository.

@@repository [sbt,Maven,Gradle] {
id="akka-repository"
name="Akka library repository"
url="https://repo.akka.io/maven"
}

## Support for Java 8 removed

The published artifacts are targeting Java 11, and later. Supported Java versions are 11 and 17.
Expand Down
3 changes: 2 additions & 1 deletion project/AkkaDependency.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object AkkaDependency {
}

// Default version updated only when needed, https://doc.akka.io//docs/akka/current/project/downstream-upgrade-strategy.html
val minimumExpectedAkkaVersion = "2.9.0-M2"
val minimumExpectedAkkaVersion = "2.9.0-M3"
val default = akkaDependency(defaultVersion = minimumExpectedAkkaVersion)
val docs = akkaDependency(defaultVersion = minimumExpectedAkkaVersion)

Expand Down Expand Up @@ -79,6 +79,7 @@ object AkkaDependency {
else
"com.typesafe.akka" %% module % akkaVersion % config
},
resolvers += "Akka library repository".at("https://repo.akka.io/maven"),
resolvers ++= (if (akkaSnapshot) Seq("Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots") else Nil)
)
}
Expand Down
38 changes: 37 additions & 1 deletion project/Publish.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@

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

/**
Expand All @@ -27,7 +32,38 @@ 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)
None // 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 91cb857

Please sign in to comment.