-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adopt GHA Scala Library Release Workflow
[`gha-scala-library-release-workflow`](https://github.com/guardian/gha-scala-library-release-workflow) provides these benefits: * **better security for release credentials** by isolating release phases into separate GitHub Workflow Jobs * **removes a lot of sbt configuration** (`gha-scala-library-release-workflow` automatically provides sensible defaults) * **automated version compatibility checking**, detecting binary & source incompatibilities, and setting SemVer-compliant version numbers appropriately - meaning that developers no longer have to assign version numbers, and sbt can now reliably detect when dependency eviction could cause runtime errors (see eg guardian/facia-scala-client#301 !) - and so block those problems at build time. The configuration changes for adopting `gha-scala-library-release-workflow` are documented in [configuration.md](https://github.com/guardian/gha-scala-library-release-workflow/blob/main/docs/configuration.md) .
- Loading branch information
Showing
8 changed files
with
52 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
name: compile-test | ||
|
||
name: CI | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
|
||
# triggering CI default branch improves caching | ||
# see https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows#restrictions-for-accessing-a-cache | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup Java 8 | ||
uses: actions/setup-java@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- uses: guardian/setup-scala@v1 | ||
- name: Build and Test | ||
run: sbt -v +test | ||
- name: Test Summary | ||
uses: test-summary/action@v2 | ||
with: | ||
java-version: '8' | ||
distribution: 'adopt' | ||
- run: sbt test | ||
paths: "test-results/**/TEST-*.xml" | ||
if: always() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v1 | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
|
||
*.class | ||
test-results/ | ||
.DS_Store | ||
|
||
# sbt specific | ||
.cache | ||
.history | ||
.cache/ | ||
.history/ | ||
.lib/ | ||
.bsp/ | ||
dist/* | ||
target/ | ||
lib_managed/ | ||
src_managed/ | ||
project/boot/ | ||
project/plugins/project/ | ||
|
||
.idea | ||
|
||
# Scala-IDE specific | ||
.scala_dependencies | ||
.worksheet | ||
.DS_Store | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
java corretto-21.0.5.11.1 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
import sbtrelease._ | ||
import ReleaseTransformations._ | ||
import ReleaseTransformations.* | ||
import sbtversionpolicy.withsbtrelease.ReleaseVersion | ||
|
||
name := "hmac-headers" | ||
|
||
scalaVersion := "2.13.7" | ||
scalaVersion := "3.3.4" | ||
|
||
organization := "com.gu" | ||
|
||
crossScalaVersions := Seq("2.11.8", "2.12.2", scalaVersion.value) | ||
crossScalaVersions := Seq("2.12.20", "2.13.15", scalaVersion.value) | ||
|
||
scmInfo := Some(ScmInfo( | ||
url("https://github.com/guardian/hmac-headers"), | ||
"scm:git:[email protected]:guardian/hmac-headers.git" | ||
)) | ||
|
||
homepage := Some(url("https://github.com/guardian/hmac-headers")) | ||
scalacOptions := Seq("-deprecation", "-release:11") | ||
|
||
libraryDependencies ++= Seq( | ||
"joda-time" % "joda-time" % "2.9.3", | ||
|
@@ -24,34 +19,10 @@ libraryDependencies ++= Seq( | |
"org.scalatest" %% "scalatest" % "3.2.10" % "test" | ||
) | ||
|
||
pomExtra := ( | ||
<developers> | ||
<developer> | ||
<id>nlindblad</id> | ||
<name>Niklas Lindblad</name> | ||
<url>https://github.com/guardian/hmac-headers</url> | ||
</developer> | ||
<developer> | ||
<id>emma-p</id> | ||
<name>Emmanuelle Poirier</name> | ||
<url>https://github.com/guardian/hmac-headers</url> | ||
</developer> | ||
</developers>) | ||
|
||
publishMavenStyle := true | ||
Test / publishArtifact := false | ||
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")) | ||
|
||
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (isSnapshot.value) | ||
Some("snapshots" at nexus + "content/repositories/snapshots") | ||
else | ||
Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
} | ||
|
||
pomIncludeRepository := { _ => false } | ||
licenses := Seq(License.Apache2) | ||
|
||
// releaseVersion := ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease().value, | ||
releaseCrossBuild := true // true if you cross-build the project for multiple Scala versions | ||
releaseProcess := Seq[ReleaseStep]( | ||
checkSnapshotDependencies, | ||
inquireVersions, | ||
|
@@ -60,9 +31,6 @@ releaseProcess := Seq[ReleaseStep]( | |
setReleaseVersion, | ||
commitReleaseVersion, | ||
tagRelease, | ||
ReleaseStep(action = Command.process("publishSigned", _)), | ||
setNextVersion, | ||
commitNextVersion, | ||
ReleaseStep(action = Command.process("sonatypeReleaseAll", _)), | ||
pushChanges | ||
) | ||
commitNextVersion | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
sbt.version=1.5.7 | ||
sbt.version=1.10.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
logLevel := Level.Warn | ||
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0") | ||
|
||
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") | ||
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") | ||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.10") | ||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.11.3") | ||
|
||
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.1") |