Skip to content

Commit d7005f0

Browse files
[CI] Migrate publishing to Central Sonatype instead of replaced OSSRH (#44)
* Upgrade sbt to 1.11.1 * Migrate publishing to Central Sonatype instead of replaced OSSRH * Fix usages of central sonatype
1 parent 9776e04 commit d7005f0

File tree

6 files changed

+23
-37
lines changed

6 files changed

+23
-37
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ jobs:
3030

3131
- name: Publish release
3232
env:
33-
MAVEN_USER: "${{ secrets.SONATYPE_USER }}"
34-
MAVEN_PASSWORD: "${{ secrets.SONATYPE_PASSWORD }}"
33+
SONATYPE_USER: "${{ secrets.SONATYPE_USER }}"
34+
SONATYPE_PASSWORD: "${{ secrets.SONATYPE_PASSWORD }}"
3535
PGP_PASSPHRASE: "${{ secrets.PGP_PASSWORD }}"
36-
run: sbt "clean;+cli/cliPack; +cli/publishSigned"
36+
run: sbt "clean;+cli/cliPack; +cli/publishSigned; sonaUpload"
3737

3838
- name: Create release artifacts
3939
run: |

build.sbt

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
val ScalaNativeVersion = "0.5.8-SNAPSHOT"
2-
// Update during release procedure to provide access to staged, but not published artifacts
3-
val StagingRepoIds = Nil
4-
val StagingRepoNames = StagingRepoIds.map(id => s"orgscala-native-$id").toSeq
52

63
val crossScalaVersions212 = (14 to 20).map("2.12." + _)
74
val crossScalaVersions213 = (8 to 16).map("2.13." + _)
85
val crossScalaVersions3 =
96
(2 to 3).map("3.1." + _) ++
107
(0 to 2).map("3.2." + _) ++
11-
(0 to 4).map("3.3." + _) ++
8+
(0 to 6).map("3.3." + _) ++
129
(0 to 3).map("3.4." + _) ++
1310
(0 to 2).map("3.5." + _) ++
14-
(2 to 3).map("3.6." + _)
11+
(2 to 4).map("3.6." + _) ++
12+
(0 to 1).map("3.7." + _) ++
13+
Nil
1514

1615
val scala2_12 = crossScalaVersions212.last
1716
val scala2_13 = crossScalaVersions213.last
1817
val scala3 = crossScalaVersions3.last
1918
val scala3PublishVersion = "3.1.3"
2019

20+
sonatypePublishSettings
21+
2122
val publishScalaVersions = Seq(scala2_12, scala2_13, scala3PublishVersion)
2223

2324
def scalaReleasesForBinaryVersion(v: String): Seq[String] = v match {
@@ -100,7 +101,7 @@ inThisBuild(
100101
)
101102
),
102103
// Used during the releases
103-
resolvers ++= StagingRepoNames.flatMap(Resolver.sonatypeOssRepos(_)),
104+
resolvers += "Sonatype Central Deployments" at "https://central.sonatype.com/api/v1/publisher/deployments/download/",
104105
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),
105106
resolvers += Resolver.mavenCentral,
106107
resolvers += Resolver.defaultLocal
@@ -154,9 +155,7 @@ lazy val cliScriptedTests = project
154155
"-Dplugin.version=" + (cli / scalaNativeVersion).value,
155156
"-Dscala.version=" + (cli / scalaVersion).value,
156157
"-Dscala-native-cli=" + cliPath,
157-
"-Dscala-native-cli-pack=" + packDir,
158-
"-Dscalanative.build.staging.resolvers=" + StagingRepoNames
159-
.mkString(",")
158+
"-Dscala-native-cli-pack=" + packDir
160159
)
161160
},
162161
scriptedBufferLog := false,
@@ -306,22 +305,24 @@ lazy val cliPackSettings = Def.settings(
306305
lazy val publishSettings = Def.settings(
307306
Compile / publishArtifact := true,
308307
Test / publishArtifact := false,
308+
sonatypePublishSettings
309+
)
310+
lazy val sonatypePublishSettings = Def.settings(
309311
publishMavenStyle := true,
310312
pomIncludeRepository := (_ => false),
311313
publishTo := {
312-
val nexus = "https://oss.sonatype.org/"
313-
if (isSnapshot.value)
314-
Some("snapshots" at nexus + "content/repositories/snapshots")
315-
else
316-
Some("releases" at nexus + "service/local/staging/deploy/maven2")
314+
val centralSnapshots =
315+
"https://central.sonatype.com/repository/maven-snapshots/"
316+
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
317+
else localStaging.value
317318
},
318319
credentials ++= {
319320
for {
320-
user <- sys.env.get("MAVEN_USER")
321-
password <- sys.env.get("MAVEN_PASSWORD")
321+
user <- sys.env.get("SONATYPE_USER")
322+
password <- sys.env.get("SONATYPE_PASSWORD")
322323
} yield Credentials(
323-
realm = "Sonatype Nexus Repository Manager",
324-
host = "oss.sonatype.org",
324+
realm = "",
325+
host = "central.sonatype.com",
325326
userName = user,
326327
passwd = password
327328
)

cli/src/sbt-test/integration/cli/build.sbt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
resolvers ++= Resolver.sonatypeOssRepos("snapshots")
2-
resolvers ++= sys.props
3-
.get("scalanative.build.staging.resolvers")
4-
.toList
5-
.flatMap(_.split(","))
6-
.flatMap(Resolver.sonatypeOssRepos(_))
72
enablePlugins(ScalaNativePlugin)
83

94
import sbt._

cli/src/sbt-test/integration/cli/project/build.sbt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,3 @@ if (pluginVersion == null)
99
else {
1010
addSbtPlugin("org.scala-native" % "sbt-scala-native" % pluginVersion)
1111
}
12-
resolvers ++= sys.props
13-
.get("scalanative.build.staging.resolvers")
14-
.toList
15-
.flatMap(_.split(","))
16-
.flatMap(Resolver.sonatypeOssRepos(_))

cli/src/sbt-test/integration/standalone/build.sbt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ scalaVersion := {
2222
)
2323
else scalaVersion
2424
}
25-
resolvers ++= sys.props
26-
.get("scalanative.build.staging.resolvers")
27-
.toList
28-
.flatMap(_.split(","))
29-
.flatMap(Resolver.sonatypeOssRepos(_))
3025

3126
runScript := {
3227
val scriptName +: rawArgs = spaceDelimited("<arg>").parsed.toSeq

project/build.properties

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

0 commit comments

Comments
 (0)