Skip to content

Commit

Permalink
Merge pull request #93 from guardian/adopt-gha-scala-library-release-…
Browse files Browse the repository at this point in the history
…workflow

Adopt GHA Scala Library Release Workflow
  • Loading branch information
rebecca-thompson authored Jan 17, 2024
2 parents 54c40b2 + 1eebbe5 commit 5006764
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 82 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
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 }}
78 changes: 30 additions & 48 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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
}
}
)
.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
)
)
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.8.0
sbt.version=1.9.8
10 changes: 2 additions & 8 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
12 changes: 0 additions & 12 deletions sonatype.sbt

This file was deleted.

1 change: 1 addition & 0 deletions version.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ThisBuild / version := "1.4.1-SNAPSHOT"

0 comments on commit 5006764

Please sign in to comment.