Skip to content

Commit

Permalink
Configure sbt-ci-release plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
folone committed Dec 25, 2023
1 parent c1595af commit e566bd0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 33 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release
on:
push:
branches: [master, main]
tags: ["*"]
jobs:
publish:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 8
cache: sbt
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
30 changes: 1 addition & 29 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -41,39 +41,14 @@ lazy val buildSettings = Def.settings(
Compile / parallelExecution := true
)

lazy val publishSetting = {
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("staging" at nexus + "service/local/staging/deploy/maven2")
}
}

lazy val credentialsSetting = credentials ++= {
Seq("build.publish.user", "build.publish.password").map(k => Option(System.getProperty(k))) match {
case Seq(Some(user), Some(pass)) =>
Seq(Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass))
case _ =>
val x = Path.userHome / ".ivy2" / ".credentials"
if (x.exists) {
Seq(Credentials(x))
} else {
Nil
}
}
}

val scalazVersion = "7.3.8"
val poiVersion = "5.2.5"

lazy val standardSettings = Def.settings(
buildSettings,
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
name := "poi-scala",
Test / fork := true,
releaseCrossBuild := true,
releasePublishArtifactsAction := PgpKeys.publishSigned.value,
libraryDependencies ++= {
Seq(
"org.apache.poi" % "poi" % poiVersion,
Expand All @@ -90,10 +65,7 @@ lazy val standardSettings = Def.settings(
conflictWarning.value
}
},
publishMavenStyle := true,
Test / publishArtifact := false,
credentialsSetting,
publishSetting,
pomExtra := (
<url>https://github.com/folone/poi.scala</url>
<licenses>
Expand Down
6 changes: 2 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")

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

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

0 comments on commit e566bd0

Please sign in to comment.