Skip to content

Commit

Permalink
Adopt GHA Scala Library Release Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rtyley committed Jan 5, 2024
1 parent 839ed67 commit b452d5b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 55 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: 'Publish Release'
name: Release

on:
workflow_dispatch: {}
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 }}
50 changes: 10 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sbt.Keys._
import ReleaseTransformations.*
import sbtversionpolicy.withsbtrelease.ReleaseVersion

name := "fezziwig"
scalaVersion := "2.13.6"
Expand All @@ -7,55 +8,24 @@ organization := "com.gu"

val circeVersion = "0.14.1"

publishMavenStyle := true
Test / publishArtifact := false
pomIncludeRepository := { _ => false }
releasePublishArtifactsAction := PgpKeys.publishSigned.value
licenses := Seq("Apache v2" -> url("http://www.apache.org/licenses/LICENSE-2.0.html"))
homepage := Some(url("https://github.com/guardian/fezziwig"))
scmInfo := Some(
ScmInfo(
url("https://github.com/guardian/fezziwig"),
"scm:[email protected]:guardian/fezziwig.git"
)
)
developers := List(
Developer(id = "tomrf1", name = "Tom Forbes", email = "", url = url("https://github.com/tomrf1")),
Developer(id = "cb372", name = "Chris Birchall", email = "", url = url("https://github.com/cb372")),
Developer(id = "mchv", name = "Mariot Chauvin", email = "", url = url("https://github.com/mchv")),
Developer(id = "LATaylor-guardian", name = "Luke Taylor", email = "", url = url("https://github.com/LATaylor-guardian")),
Developer(id = "annebyrne", name = "Anne Byrne", email = "", url = url("https://github.com/annebyrne"))
)

publishTo := sonatypePublishToBundle.value
licenses := Seq(License.Apache2)

import ReleaseTransformations._
releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value

releaseCrossBuild := true // true if you cross-build the project for multiple Scala versions

lazy val commonReleaseProcess = Seq[ReleaseStep](
releaseProcess := 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"),
setReleaseVersion,
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion
)

lazy val snapshotReleaseProcess = commonReleaseProcess

releaseProcess := {
sys.props.get("RELEASE_TYPE") match {
case Some("production") => productionReleaseProcess
case _ => snapshotReleaseProcess
}
}

libraryDependencies ++= Seq(
"io.circe" %% "circe-core" % circeVersion,
"io.circe" %% "circe-generic" % circeVersion,
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("com.twitter" % "scrooge-sbt-plugin" % "21.8.0")

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.10.0")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.0")

0 comments on commit b452d5b

Please sign in to comment.