Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt GHA Scala library release workflow #47

Merged
merged 3 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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_TOKEN: ${{ secrets.AUTOMATED_MAVEN_RELEASE_SONATYPE_TOKEN }}
PGP_PRIVATE_KEY: ${{ secrets.AUTOMATED_MAVEN_RELEASE_PGP_SECRET }}
GITHUB_APP_PRIVATE_KEY: ${{ secrets.AUTOMATED_MAVEN_RELEASE_GITHUB_APP_PRIVATE_KEY }}
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
java corretto-21.0.3.9.1

40 changes: 4 additions & 36 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sbtversionpolicy.withsbtrelease.ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease

name := "fastly-api-client"

Expand All @@ -17,7 +18,7 @@ libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.4.3" % Test
)

ThisBuild / scalacOptions ++= Seq("-deprecation", "-feature", "-language:postfixOps", "-release", "11") ++
scalacOptions ++= Seq("-deprecation", "-feature", "-language:postfixOps", "-release:11") ++
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq("-Xsource:3") // flags only needed in Scala 2
case _ => Seq.empty
Expand All @@ -27,39 +28,10 @@ enablePlugins(BuildInfoPlugin)
buildInfoKeys := Seq[BuildInfoKey](name, version)
buildInfoPackage := "com.gu.fastly.api"

publishMavenStyle := true

publishTo := sonatypePublishToBundle.value

Test / publishArtifact := false

pomIncludeRepository := { _ => false }

pomExtra := (
<url>https://github.com/guardian/fastly-api-client</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:guardian/fastly-api-client.git</url>
<connection>scm:git:[email protected]:guardian/fastly-api-client.git</connection>
</scm>
<developers>
<developer>
<id>obrienm</id>
<name>Matthew O'Brien</name>
<url>http://www.theguardian.com</url>
</developer>
</developers>
)


import ReleaseTransformations._

licenses := Seq(License.Apache2)
releaseVersion := fromAggregatedAssessedCompatibilityWithLatestRelease().value
releaseCrossBuild := true

releaseProcess := Seq[ReleaseStep](
Expand All @@ -70,10 +42,6 @@ releaseProcess := Seq[ReleaseStep](
setReleaseVersion,
commitReleaseVersion,
tagRelease,
// For non cross-build projects, use releaseStepCommand("publishSigned")
releaseStepCommandAndRemaining("+publishSigned"),
releaseStepCommand("sonatypeBundleRelease"),
setNextVersion,
commitNextVersion,
pushChanges
)
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")

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

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

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

addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.1")