diff --git a/.github/workflows/sbt.yml b/.github/workflows/sbt.yml index dc2e152..a3ea45e 100644 --- a/.github/workflows/sbt.yml +++ b/.github/workflows/sbt.yml @@ -6,6 +6,19 @@ on: jobs: build: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: olafurpg/setup-scala@v10 + with: + java-version: "adopt@1.8" + - uses: coursier/cache-action@v5 + - uses: jrouly/scalafmt-native-action@v1 + - run: csbt +test +scripted + + release: + needs: [build] + runs-on: ubuntu-latest + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/checkout@v2 with: @@ -14,10 +27,11 @@ jobs: with: java-version: "adopt@1.8" - uses: coursier/cache-action@v5 - - uses: jrouly/scalafmt-native-action@v1 - - run: csbt ^test ^scripted - - run: csbt ^publish - if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') + - uses: crazy-max/ghaction-import-gpg@v3 + with: + gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - run: csbt +publishSigned env: - ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} - ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }} + SONATYPE_USER: ${{ secrets.SONATYPE_USER }} + SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }} diff --git a/README.md b/README.md index a3fe19a..0389a55 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # sbt-openapi-diff [![Scala CI](https://github.com/jrouly/sbt-openapi-diff/workflows/Scala%20CI/badge.svg?branch=master)](https://github.com/jrouly/sbt-openapi-diff/actions?query=workflow%3A%22Scala+CI%22) -[![Download](https://api.bintray.com/packages/jrouly/sbt-plugins/sbt-openapi-diff/images/download.svg)](https://bintray.com/jrouly/sbt-plugins/sbt-openapi-diff/_latestVersion) - An sbt plugin to support the [OpenAPI Diff](https://github.com/OpenAPITools/openapi-diff) project. @@ -11,8 +9,7 @@ An sbt plugin to support the [OpenAPI Diff](https://github.com/OpenAPITools/open Add to your `project/plugins.sbt`: ```sbt -resolvers += Resolver.bintrayIvyRepo("jrouly", "sbt-plugins") -addSbtPlugin("org.openapitools.openapidiff" % "sbt-openapi-diff" % "version") +addSbtPlugin("net.rouly" % "sbt-openapi-diff" % "version") ``` Update your `build.sbt`: diff --git a/build.sbt b/build.sbt index 668ef90..31833c9 100644 --- a/build.sbt +++ b/build.sbt @@ -1,36 +1,21 @@ name := "sbt-openapi-diff" -organization := "org.openapitools.openapidiff" +organization := "net.rouly" description := "Supports functionality from openapi-diff as part of an sbt build." -homepage := Some(url("https://github.com/jrouly/sbt-openapi-diff")) -licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) - scriptedBufferLog := false scriptedLaunchOpts ++= Seq("-Xmx1024M", "-server", "-Dplugin.version=" + version.value) Global / onChangedBuildSource := ReloadOnSourceChanges enablePlugins(SbtPlugin) -sbtPlugin := true - -crossSbtVersions := List( - "0.13.18", - "1.1.6" // https://github.com/sbt/sbt/issues/5049 -) -libraryDependencies += "org.openapitools.openapidiff" % "openapi-diff-core" % "2.0.0-beta.6" +libraryDependencies += "org.openapitools.openapidiff" % "openapi-diff-core" % "2.0.0" -credentials += Credentials( - "Artifactory Realm", - "jrouly.jfrog.io", - sys.env.getOrElse("ARTIFACTORY_USER", "user"), - sys.env.getOrElse("ARTIFACTORY_PASS", "pass") -) +crossScalaVersions := Seq("2.10.7", "2.12.10") -publishMavenStyle := false -publishTo := { - def resolver(host: String, repo: String) = - Resolver.url(repo, url(s"https://$host/artifactory/$repo"))(Resolver.ivyStylePatterns) - if (isSnapshot.value) Some(resolver("jrouly.jfrog.io", "ivy-snapshot-local")) - else Some(resolver("jrouly.jfrog.io", "ivy-release-local")) +pluginCrossBuild / sbtVersion := { + scalaBinaryVersion.value match { + case "2.10" => "0.13.18" + case "2.12" => "1.1.6" // https://github.com/sbt/sbt/issues/5049 + } } diff --git a/project/plugins.sbt b/project/plugins.sbt index fdb8cdc..5ff66fb 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,5 @@ // Versions the build. addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1") + +// Sign releases. +addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") diff --git a/publish.sbt b/publish.sbt new file mode 100644 index 0000000..1ec4287 --- /dev/null +++ b/publish.sbt @@ -0,0 +1,40 @@ +import com.jsuereth.sbtpgp.PgpKeys.publishSigned +import sbt._ + +organizationHomepage := Some(url("https://openapi-generator.tech/")) +homepage := Some(url("https://openapi-generator.tech/")) +licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) + +scmInfo := Some( + ScmInfo( + url("https://github.com/jrouly/sbt-openapi-diff"), + "scm:git@github.com:jrouly/sbt-openapi-diff.git" + ) +) + +developers := List( + Developer( + id = "jrouly", + name = "Michel Rouly", + email = "michel@rouly.net", + url = url("https://michel.rouly.net") + ) +) + +credentials += Credentials( + realm = "Sonatype Nexus Repository Manager", + host = "s01.oss.sonatype.org", + userName = sys.env.getOrElse("SONATYPE_USER", "username"), + passwd = sys.env.getOrElse("SONATYPE_PASS", "password") +) + +pomIncludeRepository := { _ => false } +pgpSigningKey := Some("0xFA8B833314500A89") + +publishMavenStyle := true + +publishTo := Some { + val nexus = "https://s01.oss.sonatype.org/" + if (isSnapshot.value) "snapshots" at nexus + "content/repositories/snapshots" + else "releases" at nexus + "service/local/staging/deploy/maven2" +} diff --git a/src/sbt-test/sbt-openapi-generator/simple/project/plugin.sbt b/src/sbt-test/sbt-openapi-generator/simple/project/plugin.sbt index 8e462b7..e0d9e42 100644 --- a/src/sbt-test/sbt-openapi-generator/simple/project/plugin.sbt +++ b/src/sbt-test/sbt-openapi-generator/simple/project/plugin.sbt @@ -2,7 +2,7 @@ resolvers ++= Seq( Resolver.sonatypeRepo("snapshots") ) sys.props.get("plugin.version") match { - case Some(x) => addSbtPlugin("org.openapitools.openapidiff" % "sbt-openapi-diff" % x) + case Some(x) => addSbtPlugin("net.rouly" % "sbt-openapi-diff" % x) case _ => throw new Exception("The system property 'plugin.version' is not defined.") }