diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aaa2865..950d9a4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,15 +1,12 @@ -name: 'Publish Release' +name: Release + on: - release: - types: [published] + workflow_dispatch: + jobs: - sbt_release: - runs-on: ubuntu-latest - steps: - - uses: guardian/actions-sbt-release@v3 - with: - pgpSecret: ${{ secrets.PGP_SECRET }} - pgpPassphrase: ${{ secrets.PGP_PASSPHRASE }} - sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} - sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} - isSnapshot: ${{ github.event.release.prerelease }} \ No newline at end of file + 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 }} diff --git a/build.sbt b/build.sbt index bbdb9b1..756580f 100644 --- a/build.sbt +++ b/build.sbt @@ -1,65 +1,47 @@ import sbtrelease._ -import ReleaseStateTransformations._ - +import ReleaseStateTransformations.* +import sbtversionpolicy.withsbtrelease.ReleaseVersion name := "atom-maker-lib" -lazy val baseSettings = Seq( +lazy val artifactProductionSettings = Seq( organization := "com.gu", - scalaVersion := "2.12.17", - crossScalaVersions := Seq(scalaVersion.value, "2.13.10"), - licenses := Seq("Apache V2" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")), - scmInfo := Some(ScmInfo(url("https://github.com/guardian/atom-maker"), - "scm:git:git@github.com:guardian/atom-maker.git")), - scalacOptions := Seq("-deprecation", "-feature"), - publishTo := sonatypePublishToBundle.value, + scalaVersion := "2.12.18", + crossScalaVersions := Seq(scalaVersion.value, "2.13.12"), + licenses := Seq(License.Apache2), + scalacOptions := Seq("-deprecation", "-feature", "-release:8") ) lazy val atomPublisher = (project in file("./atom-publisher-lib")) - .settings(baseSettings: _*) .settings( - organization := "com.gu", - name := "atom-publisher-lib" + name := "atom-publisher-lib", + Test / publishArtifact := true, + artifactProductionSettings ) - .settings(Test / publishArtifact := true) lazy val atomManagerPlay = (project in file("./atom-manager-play-lib")) - .settings(baseSettings: _*) + .dependsOn(atomPublisher % "test->test;compile->compile") .settings( - organization := "com.gu", - name := "atom-manager-play-lib" + name := "atom-manager-play-lib", + Test / publishArtifact := true, + artifactProductionSettings ) - .settings(Test / publishArtifact := true) - .dependsOn(atomPublisher % "test->test;compile->compile") - -lazy val commonReleaseProcess = Seq[ReleaseStep]( - checkSnapshotDependencies, - inquireVersions, - setReleaseVersion, - runClean, - runTest, - // For non cross-build projects, use releaseStepCommand("publishSigned") - releaseStepCommandAndRemaining("+publishSigned"), -) - -lazy val productionReleaseProcess = commonReleaseProcess ++ Seq[ReleaseStep]( - releaseStepCommand("sonatypeBundleRelease"), -) - -lazy val snapshotReleaseProcess = commonReleaseProcess lazy val atomLibraries = (project in file(".")) - .aggregate(atomPublisher, atomManagerPlay) - .settings(baseSettings: _*).settings( - publishArtifact := false, - publish := {}, - publishLocal := {}, - releaseCrossBuild := true, // true if you cross-build the project for multiple Scala versions - releaseProcess := { - sys.props.get("RELEASE_TYPE") match { - case Some("production") => productionReleaseProcess - case _ => snapshotReleaseProcess - } - } -) \ No newline at end of file + .aggregate(atomPublisher, atomManagerPlay).settings( + publish / skip := true, + releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value, + releaseCrossBuild := true, // true if you cross-build the project for multiple Scala versions + releaseProcess := Seq[ReleaseStep]( + checkSnapshotDependencies, + inquireVersions, + runClean, + runTest, + setReleaseVersion, + commitReleaseVersion, + tagRelease, + setNextVersion, + commitNextVersion + ) + ) \ No newline at end of file diff --git a/project/build.properties b/project/build.properties index 40f4d4b..abbbce5 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.0 \ No newline at end of file +sbt.version=1.9.8 diff --git a/project/plugins.sbt b/project/plugins.sbt index fc9cff9..39b41a1 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,14 +1,8 @@ -// The Typesafe repository -resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/maven-releases/" - -// Use the Play sbt plugin for Play projects addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.8") addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") - -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") - -addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.15") +addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.10.0") +addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.0") // for creating test cases that use a local dynamodb addSbtPlugin("com.localytics" % "sbt-dynamodb" % "2.0.3") diff --git a/sonatype.sbt b/sonatype.sbt deleted file mode 100644 index 3f1c731..0000000 --- a/sonatype.sbt +++ /dev/null @@ -1,12 +0,0 @@ -sonatypeProfileName := "com.gu" - -ThisBuild / pomExtra := ( - https://github.com/guardian/atom-maker - - - paulmr - Paul Roberts - https://github.com/paulmr - - - ) \ No newline at end of file diff --git a/version.sbt b/version.sbt new file mode 100644 index 0000000..2d02026 --- /dev/null +++ b/version.sbt @@ -0,0 +1 @@ +ThisBuild / version := "1.4.1-SNAPSHOT"