Skip to content

Commit

Permalink
Update build and include sbt publish GH workflow
Browse files Browse the repository at this point in the history
Sets up Anghammarad to use the sbt publish GHA workflow, removing
redundant publishing plugins for sbt and eliminating sbt config
options that are no longer required.

We also include the workflow file itself, taken from the docs.

https://github.com/guardian/gha-scala-library-release-workflow/blob/main/docs/configuration.md
  • Loading branch information
adamnfish committed Apr 15, 2024
1 parent 19ad34b commit 7be0261
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 29 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/release-scala-client.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Release Scala client

on:
workflow_dispatch:

jobs:
release:
uses: guardian/gha-scala-library-release-workflow/.github/workflows/reusable-release.yml@main
permissions: { contents: write, pull-requests: write }
secrets:
SONATYPE_PASSWORD: ${{ secrets.AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD }}
PGP_PRIVATE_KEY: ${{ secrets.AUTOMATED_MAVEN_RELEASE_PGP_SECRET }}
GITHUB_APP_PRIVATE_KEY: ${{ secrets.AUTOMATED_MAVEN_RELEASE_GITHUB_APP_PRIVATE_KEY }}
44 changes: 21 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import sbtrelease.ReleaseStateTransformations.*
import sbtversionpolicy.withsbtrelease.ReleaseVersion

val compilerOptions = Seq(
"-deprecation",
"-Xfatal-warnings",
Expand All @@ -19,21 +22,12 @@ inThisBuild(Seq(
scalacOptions ++= Seq(
"-deprecation",
"-Xfatal-warnings",
"-encoding", "UTF-8"
"-encoding", "UTF-8",
"-release:11",
),
// sonatype metadata
organization := "com.gu",
licenses := Seq("Apache V2" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
scmInfo := Some(
ScmInfo(
url("https://github.com/guardian/anghammarad"),
"scm:git@github.com:guardian/anghammarad"
)
),
homepage := scmInfo.value.map(_.browseUrl),
developers := List(
Developer(id = "guardian", name = "Guardian", email = null, url = url("https://github.com/guardian"))
)
))

val awsSdkVersion = "1.12.692"
Expand All @@ -48,20 +42,27 @@ lazy val root = project
.in(file("."))
.settings(
name := "anghammarad-root",
// publish settings
releaseCrossBuild := true,
publish / skip := true,
publishTo := sonatypePublishTo.value,
releaseProcess += releaseStepCommandAndRemaining("sonatypeRelease"),
// publish settings, for common and client
releaseCrossBuild := true,
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion,
),
releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value,
)
.aggregate(anghammarad, client, common, dev)

lazy val common = project
.settings(
name := "anghammarad-common",
// publish settings
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishTo := sonatypePublishTo.value,
)

lazy val client = project
Expand All @@ -74,9 +75,6 @@ lazy val client = project
"com.typesafe.scala-logging" %% "scala-logging" % scalaLoggingVersion,
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
),
// publish settings
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
publishTo := sonatypePublishTo.value,
assemblySettings,
)

Expand Down Expand Up @@ -104,9 +102,9 @@ lazy val anghammarad = project
"ch.qos.logback" % "logback-classic" % "1.5.3",
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
),
publish / skip := true,
assembly / assemblyOutputPath := file("anghammarad/anghammarad.jar"),
assemblySettings,
publish / skip := true,
)

lazy val dev = project
Expand All @@ -115,7 +113,7 @@ lazy val dev = project
libraryDependencies ++= Seq(
"com.github.scopt" %% "scopt" % "4.1.0"
),
publish / skip := true,
assemblySettings,
publish / skip := true,
)
.dependsOn(common, anghammarad, client)
9 changes: 3 additions & 6 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.9.16")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")

addSbtPlugin("com.gu" % "sbt-riffraff-artifact" % "1.1.18")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")

// for publishing the scala client
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")

addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0")

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.0")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.0")

0 comments on commit 7be0261

Please sign in to comment.