Skip to content

Commit 4d3113f

Browse files
committed
Also fix API publishing
1 parent 2a77ec8 commit 4d3113f

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

CubicChunksAPI/build.gradle.kts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -208,23 +208,21 @@ publishing {
208208
}
209209
repositories {
210210
maven {
211-
name = "Sonatype"
211+
name = "central"
212212

213-
val user = (project.properties["sonatypeUsername"] ?: System.getenv("sonatypeUsername")) as String?
214-
val pass = (project.properties["sonatypePassword"] ?: System.getenv("sonatypePassword")) as String?
215-
val local = user == null || pass == null
213+
val local = properties["centralAuthHeaderName"] == null
216214
if (local) {
217215
logger.warn("Username or password not set, publishing to local repository in build/mvnrepo/")
218216
}
219217
val localUrl = "$buildDir/mvnrepo"
220-
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
221-
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
218+
val releasesRepoUrl = "https://central.sonatype.com/api/v1/publisher/deployments/download/"
219+
val snapshotsRepoUrl = "https://central.sonatype.com/api/v1/publisher/deployments/download/"
222220

223221
setUrl(if (local) localUrl else if (doRelease.toBoolean()) releasesRepoUrl else snapshotsRepoUrl)
224222
if (!local) {
225-
credentials {
226-
username = user
227-
password = pass
223+
credentials(HttpHeaderCredentials::class)
224+
authentication {
225+
create<HttpHeaderAuthentication>("header")
228226
}
229227
}
230228
}
@@ -257,8 +255,8 @@ publishing {
257255
// see https://docs.gradle.org/current/userguide/publishing_customization.html#sec:publishing_maven:conditional_publishing
258256
tasks.withType<PublishToMavenRepository>().configureEach {
259257
val predicate = provider {
260-
(publication == publications["mavenJava"] && repository == repositories["Sonatype"]) ||
261-
(publication == publications["versionedMavenJava"] && repository == repositories["DaPorkchop_"])
258+
(publication == publications["mavenJava"] && repository == repositories.findByName("Sonatype")) ||
259+
(publication == publications["versionedMavenJava"] && repository == repositories.findByName("DaPorkchop_"))
262260
}
263261
onlyIf("publishing API to Sonatype repository, and versioned API to DaPorkchop_ repository") {
264262
predicate.get()

0 commit comments

Comments
 (0)