Skip to content

Commit

Permalink
add publish for scala package
Browse files Browse the repository at this point in the history
  • Loading branch information
dicko2 committed Sep 13, 2024
1 parent fc91e0b commit 9d7d67c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/workflows/scalabuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,21 @@ jobs:
working-directory: scalatest-listener
run: sbt compile

- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_SECRET_KEY }}
working-directory: scalatest-listener
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import --batch
- name: Publish to Maven Central
env:
SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
working-directory: scalatest-listener
run: sbt publishSigned sonatypeBundleRelease

# Optional: Add a step to publish the artifact if needed
# - name: Publish artifact
# working-directory: scalatest-listener
Expand Down
29 changes: 28 additions & 1 deletion scalatest-listener/build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import xerial.sbt.Sonatype._

name := "scala-test-metrics"
organization := "io.agodadev"
version := "0.1.0-SNAPSHOT"
Expand All @@ -13,4 +15,29 @@ libraryDependencies ++= Seq(
"org.mockito" %% "mockito-scala-scalatest" % "1.17.12" % Test
)

testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-C", "io.agodadev.testmetricsscala.TestMetricsReporter")
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-C", "io.agodadev.testmetricsscala.TestMetricsReporter")

// Maven Central publishing settings
publishMavenStyle := true
publishTo := sonatypePublishToBundle.value
sonatypeProjectHosting := Some(GitHubHosting("agoda-com", "scala-test-metrics", "[email protected]"))
licenses := Seq("APL2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
homepage := Some(url("https://github.com/agoda-com/scala-test-metrics"))
scmInfo := Some(
ScmInfo(
url("https://github.com/agoda-com/scala-test-metrics"),
"scm:[email protected]:agoda-com/scala-test-metrics.git"
)
)
developers := List(
Developer(
id = "joeldickson",
name = "Joel Dickson",
email = "[email protected]",
url = url("http://beerandserversdontmix.com")
)
)

// PGP signing settings
usePgpKeyHex("849F9D2E")
pgpPassphrase := sys.env.get("GPG_PASSPHRASE").map(_.toArray)
4 changes: 4 additions & 0 deletions scalatest-listener/project/plugin.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

// Add these to your project/plugins.sbt if not already present
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")

0 comments on commit 9d7d67c

Please sign in to comment.