Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ env:
CI: true
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}}
PUBLISH_TO_REGISTRY: sonatype

jobs:
publish:
Expand All @@ -34,7 +35,16 @@ jobs:
- name: Import PGP key
run: echo -e "${{secrets.GPG_KEY}}" | gpg --batch --import

- name: Publish packages
- name: Publish to GitHub Pakcages
if: env.PUBLISH_TO_REGISTRY != 'sonatype'
run: |
sbt publishSigned

- name: Publish to sonatype
if: env.PUBLISH_TO_REGISTRY == 'sonatype'
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
sbt ';publishSigned; sonatypeBundleRelease'

5 changes: 4 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ ThisBuild / homepage := Some(url("https://ovotech.github.io/natchez-extras/"))

ThisBuild / licenses += ("Apache-2.0", url("https://www.apache.org/licenses/LICENSE-2.0.html"))

ThisBuild / sonatypeCredentialHost := Sonatype.sonatypeCentralHost
ThisBuild / sonatypeRepository := Sonatype.sonatypeCentralHost

ThisBuild / publishTo := {
sys.env.get("PUBLISH_TO_REGISTRY") match {
case Some("sonatype") => sonatypePublishToBundle.value
Expand Down Expand Up @@ -50,7 +53,7 @@ ThisBuild / credentials ++= (
(for {
user <- sys.env.get("SONATYPE_USERNAME")
pass <- sys.env.get("SONATYPE_PASSWORD")
} yield Credentials("Sonatype Nexus Repository Manager", "oss.sonatype.org", user, pass)).orElse {
} yield Credentials("Sonatype Nexus Repository Manager", Sonatype.sonatypeCentralHost, user, pass)).orElse {
val credentialsFile = Path.userHome / ".sbt" / ".sonatype_credentials"
if (new File(credentialsFile.toString()).exists()) Some(Credentials(credentialsFile))
else None
Expand Down