Move to new publishing portal (#4630)

* Move to new publishing portal

Signed-off-by: Alexander Brandes <mc.cache@web.de>

* Use new variables

Signed-off-by: Alexander Brandes <mc.cache@web.de>

* Try snapshot

Signed-off-by: Alexander Brandes <mc.cache@web.de>

* Back to main

Signed-off-by: Alexander Brandes <mc.cache@web.de>

---------

Signed-off-by: Alexander Brandes <mc.cache@web.de>
This commit is contained in:
Alexander Brandes 2025-04-20 22:20:30 +02:00 committed by GitHub
parent 19e6ed4b9b
commit 1b4a347e8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 68 additions and 82 deletions

View File

@ -29,18 +29,18 @@ jobs:
fi
- name: Publish Release
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Publish Snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: ./gradlew publishToSonatype
run: ./gradlew publishAllPublicationsToMavenCentralRepository
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PASSWORD }}
- name: Publish core javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
uses: cpina/github-action-push-to-another-repository@main

View File

@ -1,5 +1,6 @@
import com.diffplug.gradle.spotless.SpotlessPlugin
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.vanniktech.maven.publish.SonatypeHost
import groovy.json.JsonSlurper
import xyz.jpenilla.runpaper.task.RunServer
import java.net.URI
@ -7,13 +8,12 @@ import java.net.URI
plugins {
java
`java-library`
`maven-publish`
signing
alias(libs.plugins.shadow)
alias(libs.plugins.spotless)
alias(libs.plugins.grgit)
alias(libs.plugins.nexus)
alias(libs.plugins.publish)
eclipse
idea
@ -68,7 +68,7 @@ subprojects {
apply {
plugin<JavaPlugin>()
plugin<JavaLibraryPlugin>()
plugin<MavenPublishPlugin>()
plugin<com.vanniktech.maven.publish.MavenPublishPlugin>()
plugin<ShadowPlugin>()
plugin<SpotlessPlugin>()
plugin<SigningPlugin>()
@ -107,11 +107,6 @@ subprojects {
}
}
java {
withSourcesJar()
withJavadocJar()
}
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
@ -127,66 +122,67 @@ subprojects {
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
mavenPublishing {
coordinates(
groupId = "$group",
artifactId = project.name,
version = "${project.version}",
)
pom {
pom {
name.set(project.name)
description.set("PlotSquared, a land and world management plugin for Minecraft.")
url.set("https://github.com/IntellectualSites/PlotSquared")
name.set(project.name + " " + project.version)
description.set("PlotSquared, a land and world management plugin for Minecraft.")
url.set("https://github.com/IntellectualSites/PlotSquared")
licenses {
license {
name.set("GNU General Public License, Version 3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
distribution.set("repo")
}
}
developers {
developer {
id.set("Sauilitired")
name.set("Alexander Söderberg")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
}
developer {
id.set("NotMyFault")
name.set("Alexander Brandes")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
email.set("contact(at)notmyfault.dev")
}
developer {
id.set("SirYwell")
name.set("Hannes Greule")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
}
developer {
id.set("dordsor21")
name.set("dordsor21")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
}
}
scm {
url.set("https://github.com/IntellectualSites/PlotSquared")
connection.set("scm:git:https://github.com/IntellectualSites/PlotSquared.git")
developerConnection.set("scm:git:git@github.com:IntellectualSites/PlotSquared.git")
tag.set("${project.version}")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/IntellectualSites/PlotSquared/issues")
}
licenses {
license {
name.set("GNU General Public License, Version 3.0")
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
distribution.set("repo")
}
}
developers {
developer {
id.set("Sauilitired")
name.set("Alexander Söderberg")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
}
developer {
id.set("NotMyFault")
name.set("Alexander Brandes")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
email.set("contact(at)notmyfault.dev")
}
developer {
id.set("SirYwell")
name.set("Hannes Greule")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
}
developer {
id.set("dordsor21")
name.set("dordsor21")
organization.set("IntellectualSites")
organizationUrl.set("https://github.com/IntellectualSites")
}
}
scm {
url.set("https://github.com/IntellectualSites/PlotSquared")
connection.set("scm:git:https://github.com/IntellectualSites/PlotSquared.git")
developerConnection.set("scm:git:git@github.com:IntellectualSites/PlotSquared.git")
tag.set("${project.version}")
}
issueManagement {
system.set("GitHub")
url.set("https://github.com/IntellectualSites/PlotSquared/issues")
}
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
}
}
@ -194,7 +190,6 @@ subprojects {
compileJava {
options.compilerArgs.add("-parameters")
options.isDeprecation = true
options.encoding = "UTF-8"
}
@ -217,15 +212,6 @@ subprojects {
}
}
nexusPublishing {
this.repositories {
sonatype {
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
tasks.getByName<Jar>("jar") {
enabled = false
}

View File

@ -36,7 +36,7 @@ serverlib = "2.3.7"
shadow = "8.3.6"
grgit = "4.1.1"
spotless = "7.0.3"
nexus = "2.0.0"
publish = "0.31.0"
runPaper = "2.3.1"
[libraries]
@ -81,5 +81,5 @@ serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.re
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
grgit = { id = "org.ajoberstar.grgit", version.ref = "grgit" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" }
runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" }