@@ -380,22 +380,43 @@ artifacts {
380380
381381publishing {
382382 repositories {
383+ // only register maven.daporkchop.net repository if these environment variables are set
384+ val ossrhMavenUsername = (project.properties[" OSSRH_USERNAME" ] ? : System .getenv(" OSSRH_USERNAME" )) as String?
385+ val ossrhMavenPassword = (project.properties[" OSSRH_PASSWORD" ] ? : System .getenv(" OSSRH_PASSWORD" )) as String?
383386 maven {
384- name = " central "
387+ name = " ossrh-staging-api "
385388
386- val local = properties[ " centralAuthHeaderName " ] == null
389+ val local = ossrhMavenUsername == null || ossrhMavenPassword == null
387390 if (local) {
388391 logger.warn(" Username or password not set, publishing to local repository in build/mvnrepo/" )
389392 }
390393 val localUrl = " $buildDir /mvnrepo"
391- val releasesRepoUrl = " https://central.sonatype.com/api/v1/publisher/upload"
392- val snapshotsRepoUrl = " https://central.sonatype.com/api/v1/publisher/upload"
394+ val releasesRepoUrl = " https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
395+ // NOTE:
396+ //
397+ // Consuming Via Gradle⚓︎
398+ //
399+ // Configure your build.gradle file with the following:
400+ //
401+ // repositories {
402+ // maven {
403+ // name = 'Central Portal Snapshots'
404+ // url = 'https://central.sonatype.com/repository/maven-snapshots/'
405+ //
406+ // // Only search this repository for the specific dependency
407+ // content {
408+ // includeModule("<the snapshot's groupId>", "<the snapshot's artifactId>")
409+ // }
410+ // }
411+ // mavenCentral()
412+ // }
413+ val snapshotsRepoUrl = " https://central.sonatype.com/repository/maven-snapshots/"
393414
394415 setUrl(if (local) localUrl else if (doRelease.toBoolean()) releasesRepoUrl else snapshotsRepoUrl)
395416 if (! local) {
396- credentials( HttpHeaderCredentials :: class )
397- authentication {
398- create< HttpHeaderAuthentication >( " header " )
417+ credentials {
418+ username = ossrhMavenUsername
419+ password = ossrhMavenPassword
399420 }
400421 }
401422 }
@@ -496,7 +517,7 @@ publishing {
496517 // see https://docs.gradle.org/current/userguide/publishing_customization.html#sec:publishing_maven:conditional_publishing
497518 tasks.withType<PublishToMavenRepository >().configureEach {
498519 val predicate = provider {
499- (publication == publications[" mod" ] && repository == repositories.findByName(" central " )) ||
520+ (publication == publications[" mod" ] && repository == repositories.findByName(" ossrh-staging-api " )) ||
500521 (publication == publications[" versionedMod" ] && repository == repositories.findByName(" DaPorkchop_" ))
501522 }
502523 onlyIf(" publishing mod to Sonatype repository, and versioned mod to DaPorkchop_ repository" ) {
0 commit comments