Skip to content

Commit

Permalink
Adopt GHA-Scala-Library-Release-Workflow
Browse files Browse the repository at this point in the history
https://github.com/guardian/gha-scala-library-release-workflow gives
us an automated way to publish releases of this library without needing
individual Sonatype credentials for each developer!

See also the list of Guardian projects that have adopted this workflow
so far:

guardian/gha-scala-library-release-workflow#20
  • Loading branch information
rtyley committed Jan 16, 2024
1 parent 4edadda commit 62b44bf
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 50 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Release

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 }}
48 changes: 4 additions & 44 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sbtrelease.ReleaseStateTransformations._
import sbtversionpolicy.withsbtrelease.ReleaseVersion

name:="cross-platform-navigation"

Expand All @@ -19,51 +20,13 @@ Test / unmanagedResourceDirectories += baseDirectory.value / "json"

enablePlugins(BuildInfoPlugin)

def listJsonFiles(file: File) : List[File] = {
if(file.isDirectory) {
file.listFiles().toList.flatMap(listJsonFiles)
} else {
List(file)
}
}

def listJsonFilesInJsonDir: List[(File, String)] = {

val jsonFilesDir = file("json")
val jsonDir = jsonFilesDir.getAbsoluteFile.toPath.getParent

listJsonFiles(jsonFilesDir).map {
file => file -> jsonDir.relativize(file.getAbsoluteFile.toPath).toString
}
}

publishTo := sonatypePublishToBundle.value
publishMavenStyle := true
Test / publishArtifact := false
pomIncludeRepository := {_ => false}
description := "Provides scala representation of the navigation menus for the www.theguardian.com and guardian apps"

pomExtra in Global := {
<url>https://github.com/guardian/cross-platform-navigation</url>
<developers>
<developer>
<id>@guardian</id>
<name>The guardian</name>
<url>https://github.com/guardian</url>
</developer>
</developers>
}


//PgpPublis
organization := "com.gu"
licenses := Seq("Apache v2" -> url("http://www.apache.org/licenses/LICENSE-2.0.html"))
scmInfo := Some(ScmInfo(
url("https://github.com/guardian/cross-platform-navigation"),
"scm:git:[email protected]:guardian/cross-platform-navigation.git"
))
licenses := Seq(License.Apache2)
scalacOptions ++= Seq("-deprecation", "-unchecked", "-release:11")
releaseCrossBuild := true
releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value
releaseProcess := Seq(
checkSnapshotDependencies,
inquireVersions,
Expand All @@ -72,11 +35,8 @@ releaseProcess := Seq(
setReleaseVersion,
commitReleaseVersion,
tagRelease,
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
commitNextVersion
)

Test/testOptions += Tests.Argument(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.0
sbt.version=1.9.8
8 changes: 4 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0")

addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")

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

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

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.0")

2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ThisBuild / version := "1.3-SNAPSHOT"
ThisBuild / version := "1.3.0-SNAPSHOT"

0 comments on commit 62b44bf

Please sign in to comment.