Skip to content

Commit 7ceb295

Browse files
committed
Switch to sbt-ci-release 1.11.2 for Central Portal publishing
- Upgrade sbt 1.9.8 → 1.11.0 (required for Central Portal support) - Replace sbt-sonatype + sbt-pgp with sbt-ci-release 1.11.2 - Remove version.sbt (sbt-dynver derives version from git tags) - Simplify publish workflow to use ci-release command - Central Portal is now the default (no legacy OSSRH needed) - Add Maven Central badges and installation section to README
1 parent 9af9518 commit 7ceb295

File tree

5 files changed

+16
-46
lines changed

5 files changed

+16
-46
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
name: Publish to Maven Central
22

33
on:
4-
release:
5-
types: [published]
6-
workflow_dispatch:
7-
inputs:
8-
version:
9-
description: 'Version to publish (e.g., 0.7.0)'
10-
required: true
11-
type: string
4+
push:
5+
tags:
6+
- "v*"
127

138
jobs:
149
publish:
1510
runs-on: ubuntu-latest
1611
name: Publish to Maven Central
17-
1812
steps:
1913
- name: Checkout code
2014
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # sbt-dynver needs full git history
2117

2218
- name: Set up JDK 17
2319
uses: actions/setup-java@v4
@@ -28,39 +24,18 @@ jobs:
2824
- name: Set up sbt
2925
uses: sbt/setup-sbt@v1
3026

31-
- name: Import GPG key
32-
uses: crazy-max/ghaction-import-gpg@v6
33-
with:
34-
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
35-
passphrase: ${{ secrets.GPG_PASSPHRASE }}
36-
37-
- name: Publish Scala 2.13 artifacts
27+
- name: Publish Scala 2.13
28+
run: sbt ++2.13.14 ci-release
3829
env:
39-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
40-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
4130
PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
42-
run: |
43-
sbt ++2.13.14 \
44-
'set credentials += Credentials("Sonatype Nexus Repository Manager", "central.sonatype.com", sys.env("SONATYPE_USERNAME"), sys.env("SONATYPE_PASSWORD"))' \
45-
'set pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray)' \
46-
clean compile publishSigned
47-
48-
- name: Publish Scala 2.12 artifacts
49-
env:
31+
PGP_SECRET: ${{ secrets.GPG_PRIVATE_KEY }}
5032
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
5133
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
52-
PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
53-
run: |
54-
sbt ++2.12.18 \
55-
'set credentials += Credentials("Sonatype Nexus Repository Manager", "central.sonatype.com", sys.env("SONATYPE_USERNAME"), sys.env("SONATYPE_PASSWORD"))' \
56-
'set pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray)' \
57-
clean compile publishSigned
5834

59-
- name: Release to Maven Central
35+
- name: Publish Scala 2.12
36+
run: sbt ++2.12.18 ci-release
6037
env:
38+
PGP_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
39+
PGP_SECRET: ${{ secrets.GPG_PRIVATE_KEY }}
6140
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
6241
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
63-
run: |
64-
sbt \
65-
'set credentials += Credentials("Sonatype Nexus Repository Manager", "central.sonatype.com", sys.env("SONATYPE_USERNAME"), sys.env("SONATYPE_PASSWORD"))' \
66-
sonatypeBundleRelease

build.sbt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ javacOptions ++= (if (javaMajor <= 8) Seq("-source", "1.8", "-target", "1.8") el
6767
Test / publishArtifact := false
6868
pomIncludeRepository := { _ => false }
6969

70-
// Sonatype Central Portal settings
71-
sonatypeProfileName := "com.massivedatascience"
72-
publishTo := sonatypePublishToBundle.value
73-
sonatypeCredentialHost := "central.sonatype.com"
70+
// sbt-ci-release 1.11+ publishes to Central Portal by default
7471

7572
// POM metadata required by Maven Central
7673
homepage := Some(url("https://github.com/derrickburns/generalized-kmeans-clustering"))

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.9.8
1+
sbt.version=1.11.0

project/plugins.sbt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.2.2")
3939
// Resolve scala-xml version conflict between scoverage and scalariform
4040
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
4141

42-
// Publishing plugins
43-
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.21")
44-
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
42+
// Publishing to Maven Central via Central Portal (requires sbt 1.11+)
43+
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.11.2")
4544

4645
// Documentation
4746
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")

version.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)