Skip to content

Commit 8095495

Browse files
committed
Attempt to fix publishing
1 parent 68e96f2 commit 8095495

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

.github/workflows/build_and_publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ jobs:
2727
java-version: '8'
2828
- name: Build with Gradle
2929
env:
30-
sonatypeUsername: ${{ secrets.OSSRH_USERNAME }}
31-
sonatypePassword: ${{ secrets.OSSRH_PASSWORD }}
30+
centralAuthHeaderName: ${{ secrets.CENTRAL_AUTH_TOKEN }}
3231
run: ./gradlew build publish
3332
- uses: actions/upload-artifact@v4
3433
with:

build.gradle.kts

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -378,26 +378,33 @@ artifacts {
378378
add("apiArchives", tasks["deobfApiJar"])
379379
}
380380

381+
repositories {
382+
maven {
383+
name = "centralManualTesting"
384+
url ""
385+
386+
}
387+
mavenCentral()
388+
}
389+
381390
publishing {
382391
repositories {
383392
maven {
384-
name = "Sonatype"
393+
name = "central"
385394

386-
val user = (project.properties["sonatypeUsername"] ?: System.getenv("sonatypeUsername")) as String?
387-
val pass = (project.properties["sonatypePassword"] ?: System.getenv("sonatypePassword")) as String?
388-
val local = user == null || pass == null
395+
val local = properties["centralAuthHeaderName"] == null
389396
if (local) {
390397
logger.warn("Username or password not set, publishing to local repository in build/mvnrepo/")
391398
}
392399
val localUrl = "$buildDir/mvnrepo"
393-
val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
394-
val snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
400+
val releasesRepoUrl = "https://central.sonatype.com/api/v1/publisher/deployments/download/"
401+
val snapshotsRepoUrl = "https://central.sonatype.com/api/v1/publisher/deployments/download/"
395402

396403
setUrl(if (local) localUrl else if (doRelease.toBoolean()) releasesRepoUrl else snapshotsRepoUrl)
397404
if (!local) {
398-
credentials {
399-
username = user
400-
password = pass
405+
credentials(HttpHeaderCredentials::class)
406+
authentication {
407+
create<HttpHeaderAuthentication>("header")
401408
}
402409
}
403410
}

0 commit comments

Comments
 (0)