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 fi
- name: Publish Release - name: Publish Release
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}} 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: env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
- name: Publish Snapshot - name: Publish Snapshot
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }} if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: ./gradlew publishToSonatype run: ./gradlew publishAllPublicationsToMavenCentralRepository
env: env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PASSWORD }}
- name: Publish core javadoc - name: Publish core javadoc
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}} 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 uses: cpina/github-action-push-to-another-repository@main

View File

@ -1,5 +1,6 @@
import com.diffplug.gradle.spotless.SpotlessPlugin import com.diffplug.gradle.spotless.SpotlessPlugin
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import com.vanniktech.maven.publish.SonatypeHost
import groovy.json.JsonSlurper import groovy.json.JsonSlurper
import xyz.jpenilla.runpaper.task.RunServer import xyz.jpenilla.runpaper.task.RunServer
import java.net.URI import java.net.URI
@ -7,13 +8,12 @@ import java.net.URI
plugins { plugins {
java java
`java-library` `java-library`
`maven-publish`
signing signing
alias(libs.plugins.shadow) alias(libs.plugins.shadow)
alias(libs.plugins.spotless) alias(libs.plugins.spotless)
alias(libs.plugins.grgit) alias(libs.plugins.grgit)
alias(libs.plugins.nexus) alias(libs.plugins.publish)
eclipse eclipse
idea idea
@ -68,7 +68,7 @@ subprojects {
apply { apply {
plugin<JavaPlugin>() plugin<JavaPlugin>()
plugin<JavaLibraryPlugin>() plugin<JavaLibraryPlugin>()
plugin<MavenPublishPlugin>() plugin<com.vanniktech.maven.publish.MavenPublishPlugin>()
plugin<ShadowPlugin>() plugin<ShadowPlugin>()
plugin<SpotlessPlugin>() plugin<SpotlessPlugin>()
plugin<SigningPlugin>() plugin<SigningPlugin>()
@ -107,11 +107,6 @@ subprojects {
} }
} }
java {
withSourcesJar()
withJavadocJar()
}
val javaComponent = components["java"] as AdhocComponentWithVariants val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) { javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip() skip()
@ -127,14 +122,15 @@ subprojects {
} }
} }
publishing { mavenPublishing {
publications { coordinates(
create<MavenPublication>("maven") { groupId = "$group",
from(components["java"]) artifactId = project.name,
version = "${project.version}",
)
pom { pom {
name.set(project.name)
name.set(project.name + " " + project.version)
description.set("PlotSquared, a land and world management plugin for Minecraft.") description.set("PlotSquared, a land and world management plugin for Minecraft.")
url.set("https://github.com/IntellectualSites/PlotSquared") url.set("https://github.com/IntellectualSites/PlotSquared")
@ -185,8 +181,8 @@ subprojects {
system.set("GitHub") system.set("GitHub")
url.set("https://github.com/IntellectualSites/PlotSquared/issues") url.set("https://github.com/IntellectualSites/PlotSquared/issues")
} }
}
} publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
} }
} }
@ -194,7 +190,6 @@ subprojects {
compileJava { compileJava {
options.compilerArgs.add("-parameters") options.compilerArgs.add("-parameters")
options.isDeprecation = true
options.encoding = "UTF-8" 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") { tasks.getByName<Jar>("jar") {
enabled = false enabled = false
} }

View File

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