diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fa4c04c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: Release +on: + push: + branches: [master, main] + tags: ["*"] +jobs: + publish: + runs-on: ubuntu-latest + 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 }} diff --git a/build.sbt b/build.sbt index 12d0ae4..2dbf2f3 100644 --- a/build.sbt +++ b/build.sbt @@ -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, @@ -90,10 +65,7 @@ lazy val standardSettings = Def.settings( conflictWarning.value } }, - publishMavenStyle := true, Test / publishArtifact := false, - credentialsSetting, - publishSetting, pomExtra := ( https://github.com/folone/poi.scala diff --git a/project/plugins.sbt b/project/plugins.sbt index a631494..01b8da4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -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")