Skip to content

Commit

Permalink
Merge pull request #44 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
davidfurey committed Feb 21, 2024
2 parents 9ea85f1 + 5b7cc66 commit d792153
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 31 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:
AUTOMATED_MAVEN_RELEASE_PGP_SECRET: ${{ secrets.AUTOMATED_MAVEN_RELEASE_PGP_SECRET }}
AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD: ${{ secrets.AUTOMATED_MAVEN_RELEASE_SONATYPE_PASSWORD }}
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# tags-thrift-schema
[![tags-thrift-schema Scala version support](https://index.scala-lang.org/guardian/tags-thrift-schema/tags-thrift-schema/latest-by-scala-version.svg?platform=jvm)](https://index.scala-lang.org/guardian/tags-thrift-schema/tags-thrift-schema)
[![Release](https://github.com/guardian/tags-thrift-schema/actions/workflows/release.yml/badge.svg)](https://github.com/guardian/tags-thrift-schema/actions/workflows/release.yml)

This repository contains the Thrift schema required for interaction with [guardian/tagmanager](https://github.com/guardian/tagmanager).

Expand All @@ -14,16 +16,8 @@ If you need to try out your changes with consumer applications (e.g. `tagmanager
- Run `+publishLocal` in sbt (note the `+` makes it cross-compile, e.g. `tagmanager` consumes the 2.11 version)
- Update the version in the consumer application(s) (e.g. https://github.com/guardian/tagmanager/blob/e47465cbbcdf9e3d3312c5c779eb52fe0676ce4a/build.sbt#L29) using the `-SNAPSHOT` version.

### Publishing a new version

1. Follow the instructions for [publishing a new version to Maven Central via Sonatype](https://docs.google.com/document/d/1rNXjoZDqZMsQblOVXPAIIOMWuwUKe3KzTCttuqS7AcY/edit#).
This will include (if not already completed for another project):
- Creating and publishing a PGP key
- Setting up an account on Sonatype and having it added to the `com.gu` group
- Storing your Sonatype credentials in your global sbt configuration
2. Ensure you're on the branch which holds the changes you're ready to release and that these changes have been approved & tested with the application(s) which use this library (using the `-SNAPSHOT` version).
3. Ensure the project still builds with `sbt compile`
4. Run `sbt release`. You will be prompted for a 'release version' – which you should set following semantic versioning as either a patch,
minor or major version bump. You will also be prompted for a 'next version' – which should be a patch version ahead of your release version
and end `-SNAPSHOT`. `version.sbt` will be updated to reflect this 'next version'.
# Publishing a new release

This repo uses [`gha-scala-library-release-workflow`](https://github.com/guardian/gha-scala-library-release-workflow)
to automate publishing releases (both full & preview releases) - see
[**Making a Release**](https://github.com/guardian/gha-scala-library-release-workflow/blob/main/docs/making-a-release.md).
27 changes: 10 additions & 17 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,41 +1,34 @@
import ReleaseTransformations._
import sbtversionpolicy.withsbtrelease.ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease

name := "tags-thrift-schema"
organization := "com.gu"

scmInfo := Some(ScmInfo(url("https://github.com/guardian/tags-thrift-schema"), "scm:git@github.com:guardian/tags-thrift-schema"))
homepage := scmInfo.value.map(_.browseUrl)
developers := List(Developer(id = "guardian", name = "Guardian", email = null, url = url("https://github.com/guardian")))


libraryDependencies ++= Seq(
"org.apache.thrift" % "libthrift" % "0.13.0",
"com.twitter" %% "scrooge-core" % "19.11.0"
)

// Might cross compile more scala versions here depending on who needs this!
scalaVersion := "2.13.1"
crossScalaVersions := Seq("2.11.12", "2.12.10", scalaVersion.value)
scalaVersion := "2.13.11"
crossScalaVersions := Seq("2.12.18", scalaVersion.value)
scalacOptions := Seq(
"-release:11"
)
releaseCrossBuild := true

resolvers += Resolver.jcenterRepo
licenses := Seq(License.Apache2)

licenses += ("Apache-2.0", url("https://github.com/guardian/tags-thrift-schema/blob/main/LICENSE"))

releasePublishArtifactsAction := PgpKeys.publishSigned.value
publishTo := sonatypePublishTo.value
releaseVersion := fromAggregatedAssessedCompatibilityWithLatestRelease().value

releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
publishArtifacts,
releaseStepCommand("sonatypeReleaseAll"),
commitReleaseVersion,
tagRelease,
setNextVersion,
commitNextVersion,
pushChanges
)
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.5.7
sbt.version=1.9.8
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Plugin to actually build the thrift
addSbtPlugin("com.twitter" %% "scrooge-sbt-plugin" % "19.11.0")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("ch.epfl.scala" % "sbt-version-policy" % "3.2.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.4")
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")

0 comments on commit d792153

Please sign in to comment.