Skip to content

Commit

Permalink
Merge pull request #39 from rtimush/sonatype
Browse files Browse the repository at this point in the history
Publish to sonatype
  • Loading branch information
rtimush committed Feb 7, 2021
2 parents 5647580 + 829833a commit 22795f0
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,19 @@ jobs:
~/.cache/coursier/v1
~/.ivy2/cache
key: ${{ runner.os }}-publish-cache-${{ matrix.sbt }}-${{ hashFiles('*.sbt') }}-${{ hashFiles('project/*') }}
- uses: crazy-max/ghaction-import-gpg@v3
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
- uses: olafurpg/setup-scala@v10
with:
java-version: zulu@1.8
- run: sbt publish
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_PASS: ${{ secrets.BINTRAY_PASS }}
- run: sbt publishSigned
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- if: startsWith(github.ref, 'refs/tags/')
run: sbt sonatypeBundleRelease
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@ Add the following line to the `plugins.sbt` file:
addSbtPlugin("com.timushev.sbt" % "sbt-rewarn" % "x.x.x")
```

The latest version is ![Bintray](https://img.shields.io/bintray/v/rtimush/sbt-plugins/sbt-rewarn?color=blue&label=sbt-rewarn&style=plastic)
The latest version is ![Sonatype](https://img.shields.io/nexus/r/com.timushev.sbt/sbt-rewarn?label=sbt-rewarn%20&server=https%3A%2F%2Foss.sonatype.org)

No additional configuration is necessary, the plugin will be automatically activated.

### Snapshot version
Choose one of versions available on [BinTray](https://bintray.com/rtimush/sbt-plugin-snapshots/sbt-rewarn/view)
or the [latest](https://bintray.com/rtimush/sbt-plugin-snapshots/sbt-rewarn/_latestVersion) one. Then add the following lines to the `plugins.sbt` file:
Choose one of versions available on [Sonatype](https://oss.sonatype.org/content/repositories/snapshots/com/timushev/sbt/sbt-rewarn_2.12_1.0/). Then add the following lines to the `plugins.sbt` file:

```
resolvers += Resolver.bintrayIvyRepo("rtimush", "sbt-plugin-snapshots")
addSbtPlugin("com.timushev.sbt" % "sbt-rewarn" % "x.x.x-y-zzzzzzz")
resolvers += Resolver.sonatypeRepo("snapshots")
addSbtPlugin("com.timushev.sbt" % "sbt-rewarn" % "x.x.x-y-zzzzzzz-SNAPSHOT")
```

Note, that snapshots are not updated automatically.
23 changes: 13 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import SbtAxis.RichProjectMatrix
import com.rallyhealth.sbt.versioning.SnapshotVersion

ThisBuild / organization := "com.timushev.sbt"
ThisBuild / isSnapshot := (ThisBuild / versionFromGit).value.isInstanceOf[SnapshotVersion]
ThisBuild / version := (ThisBuild / version).value.replaceAll("""-SNAPSHOT$""", "")
ThisBuild / homepage := Some(url("https://github.com/rtimush/sbt-rewarn"))
ThisBuild / licenses += (("BSD 3-Clause", url("https://github.com/rtimush/sbt-rewarn/blob/master/LICENSE")))
ThisBuild / publishTo := sonatypePublishToBundle.value
ThisBuild / developers := List(
Developer("rtimush", "Roman Timushev", "rtimush@gmail.com", url("https://github.com/rtimush"))
)
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/rtimush/sbt-rewarn"),
"scm:git:https://github.com/rtimush/sbt-rewarn.git",
Some("scm:git:git@github.com:rtimush/sbt-rewarn.git")
)
)

sonatypeProfileName := "com.timushev"

ThisBuild / scalacOptions := Seq("-deprecation", "-unchecked", "-feature")

Expand All @@ -18,12 +28,6 @@ lazy val `sbt-1.2.0` = SbtAxis("1.2.0")
lazy val `sbt-1.1.0` = SbtAxis("1.1.0")
lazy val `sbt-1.0.0` = SbtAxis("1.0.0")

lazy val publishSettings = Seq(
publishMavenStyle := false,
bintrayRepository := (if (isSnapshot.value) "sbt-plugin-snapshots" else "sbt-plugins"),
bintrayReleaseOnPublish := isSnapshot.value
)

lazy val `sbt-rewarn-common` = (project in file("common"))
.disablePlugins(GitVersioningPlugin)
.settings(
Expand All @@ -49,7 +53,6 @@ lazy val `sbt-rewarn` = (projectMatrix in file("plugin"))
Compile / products ++= (`sbt-rewarn-common` / Compile / products).value,
Compile / products ++= (`sbt-rewarn-adapter-lsp` / Compile / products).value
)
.settings(publishSettings)
)
.sbtScriptedRow(`sbt-1.0.0`, `sbt-1.x`)
.sbtScriptedRow(`sbt-1.1.0`, `sbt-1.x`)
Expand Down
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
resolvers += Resolver.bintrayIvyRepo("rallyhealth", "sbt-plugins")

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.6.1")
addSbtPlugin("com.rallyhealth.sbt" % "sbt-git-versioning" % "1.4.0")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.7.0")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1")

0 comments on commit 22795f0

Please sign in to comment.