Skip to content

Commit 7a333e7

Browse files
committed
Adopt GHA Scala Library Release Workflow
This is the second library, after https://github.com/guardian/etag-caching, to adopt https://github.com/guardian/gha-scala-library-release-workflow/blob/main/README.md . The changes required to adopt the automated workflow: * No need to set `sonatypeProfileName` or `ThisBuild / publishTo`, that's now done by the workflow. * Remove the sign, publish, release & push steps of sbt-release's `releaseProcess` configuration, because the workflow does those now, and the workflow only wants `sbt release` to create the versioning commits, and tag them appropriately. The workflow does the rest itself. * Remove `sbt-pgp` plugin because it's no longer used - the workflow does the signing using `gpg` directly. Additionally, we add **automatic version numbering** based on compatibility assessment performed by `sbt-version-policy`: * Add the `sbt-version-policy` plugin, to allow it to do the compatibility assessment. This also sets the `versionScheme` for this library to `early-semver`, which is the recommended versioning for Scala libraries, and `sbt-version-policy` and correct sbt-eviction-issue-detection pretty much depend on the `versionScheme` being `early-semver`. Thus we also need to switch to using a new semver version number for our library version! * Add the `releaseVersion := fromAggregatedAssessedCompatibilityWithLatestRelease().value` sbt setting, which will intelligently set the release version based on `sbt-version-policy`'s compatibility assessment, thanks to scalacenter/sbt-version-policy#187 . * Use `publish / skip := true`, rather than other hacks like `publish := {}` or `publishArtifact := false`, to tell sbt not to publish modules that we don't want published (typically, the 'root' module) - this is important because `sbt-version-policy` won't understand those hacks, but _will_ understand `publish / skip := true` means that it doesn't need to assess compatibility there.
1 parent 22b3192 commit 7a333e7

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

.github/workflows/release.yml

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
uses: guardian/gha-scala-library-release-workflow/.github/workflows/reusable-release.yml@main
9+
permissions:
10+
contents: write
11+
secrets:
12+
AUTOMATED_MAVEN_RELEASE_PGP_SECRET: ${{ secrets.AUTOMATED_MAVEN_RELEASE_PGP_SECRET }}
13+
AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD: ${{ secrets.AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD }}

build.sbt

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import ReleaseTransformations._
1+
import ReleaseTransformations.*
2+
import sbtversionpolicy.withsbtrelease.ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease
23

34
lazy val baseSettings = Seq(
45
scalaVersion := "2.13.11",
@@ -86,9 +87,8 @@ lazy val `play-secret-rotation-root` = (project in file("."))
8687
`aws-parameterstore-lambda`
8788
)
8889
.settings(baseSettings).settings(
89-
publishArtifact := false,
90-
publish := {},
91-
publishLocal := {},
90+
publish / skip := true,
91+
releaseVersion := fromAggregatedAssessedCompatibilityWithLatestRelease().value,
9292
releaseCrossBuild := true, // true if you cross-build the project for multiple Scala versions
9393
releaseProcess := Seq[ReleaseStep](
9494
checkSnapshotDependencies,
@@ -98,11 +98,7 @@ lazy val `play-secret-rotation-root` = (project in file("."))
9898
setReleaseVersion,
9999
commitReleaseVersion,
100100
tagRelease,
101-
// For non cross-build projects, use releaseStepCommand("publishSigned")
102-
releaseStepCommandAndRemaining("+publishSigned"),
103-
releaseStepCommand("sonatypeBundleRelease"),
104101
setNextVersion,
105-
commitNextVersion,
106-
pushChanges
102+
commitNextVersion
107103
)
108104
)

project/plugins.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
1+
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.1.0")
22

3-
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
3+
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")
44

55
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
66

sonatype.sbt

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
sonatypeProfileName := "com.gu"
2-
3-
ThisBuild / publishTo := sonatypePublishToBundle.value
4-
51
ThisBuild / scmInfo := Some(ScmInfo(
62
url("https://github.com/guardian/play-secret-rotation"),
73
"scm:git:[email protected]:guardian/play-secret-rotation.git"

version.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ThisBuild / version := "0.41-SNAPSHOT"
1+
ThisBuild / version := "1.0.0-SNAPSHOT"

0 commit comments

Comments
 (0)