Skip to content

Commit 1b4a347

Browse files
authored
Move to new publishing portal (#4630)
* Move to new publishing portal Signed-off-by: Alexander Brandes <[email protected]> * Use new variables Signed-off-by: Alexander Brandes <[email protected]> * Try snapshot Signed-off-by: Alexander Brandes <[email protected]> * Back to main Signed-off-by: Alexander Brandes <[email protected]> --------- Signed-off-by: Alexander Brandes <[email protected]>
1 parent 19e6ed4 commit 1b4a347

File tree

3 files changed

+70
-84
lines changed

3 files changed

+70
-84
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ jobs:
2929
fi
3030
- name: Publish Release
3131
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
32-
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository
32+
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache
3333
env:
34-
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
35-
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
34+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_USERNAME }}
35+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PASSWORD }}
3636
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
3737
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
3838
- name: Publish Snapshot
3939
if: ${{ runner.os == 'Linux' && env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main' }}
40-
run: ./gradlew publishToSonatype
40+
run: ./gradlew publishAllPublicationsToMavenCentralRepository
4141
env:
42-
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
43-
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
42+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.CENTRAL_USERNAME }}
43+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.CENTRAL_PASSWORD }}
4444
- name: Publish core javadoc
4545
if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}
4646
uses: cpina/github-action-push-to-another-repository@main

build.gradle.kts

Lines changed: 62 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import com.diffplug.gradle.spotless.SpotlessPlugin
22
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
3+
import com.vanniktech.maven.publish.SonatypeHost
34
import groovy.json.JsonSlurper
45
import xyz.jpenilla.runpaper.task.RunServer
56
import java.net.URI
67

78
plugins {
89
java
910
`java-library`
10-
`maven-publish`
1111
signing
1212

1313
alias(libs.plugins.shadow)
1414
alias(libs.plugins.spotless)
1515
alias(libs.plugins.grgit)
16-
alias(libs.plugins.nexus)
16+
alias(libs.plugins.publish)
1717

1818
eclipse
1919
idea
@@ -68,7 +68,7 @@ subprojects {
6868
apply {
6969
plugin<JavaPlugin>()
7070
plugin<JavaLibraryPlugin>()
71-
plugin<MavenPublishPlugin>()
71+
plugin<com.vanniktech.maven.publish.MavenPublishPlugin>()
7272
plugin<ShadowPlugin>()
7373
plugin<SpotlessPlugin>()
7474
plugin<SigningPlugin>()
@@ -107,11 +107,6 @@ subprojects {
107107
}
108108
}
109109

110-
java {
111-
withSourcesJar()
112-
withJavadocJar()
113-
}
114-
115110
val javaComponent = components["java"] as AdhocComponentWithVariants
116111
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
117112
skip()
@@ -127,74 +122,74 @@ subprojects {
127122
}
128123
}
129124

130-
publishing {
131-
publications {
132-
create<MavenPublication>("maven") {
133-
from(components["java"])
134-
135-
pom {
136-
137-
name.set(project.name + " " + project.version)
138-
description.set("PlotSquared, a land and world management plugin for Minecraft.")
139-
url.set("https://github.com/IntellectualSites/PlotSquared")
140-
141-
licenses {
142-
license {
143-
name.set("GNU General Public License, Version 3.0")
144-
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
145-
distribution.set("repo")
146-
}
147-
}
148-
149-
developers {
150-
developer {
151-
id.set("Sauilitired")
152-
name.set("Alexander Söderberg")
153-
organization.set("IntellectualSites")
154-
organizationUrl.set("https://github.com/IntellectualSites")
155-
}
156-
developer {
157-
id.set("NotMyFault")
158-
name.set("Alexander Brandes")
159-
organization.set("IntellectualSites")
160-
organizationUrl.set("https://github.com/IntellectualSites")
161-
email.set("contact(at)notmyfault.dev")
162-
}
163-
developer {
164-
id.set("SirYwell")
165-
name.set("Hannes Greule")
166-
organization.set("IntellectualSites")
167-
organizationUrl.set("https://github.com/IntellectualSites")
168-
}
169-
developer {
170-
id.set("dordsor21")
171-
name.set("dordsor21")
172-
organization.set("IntellectualSites")
173-
organizationUrl.set("https://github.com/IntellectualSites")
174-
}
175-
}
176-
177-
scm {
178-
url.set("https://github.com/IntellectualSites/PlotSquared")
179-
connection.set("scm:git:https://github.com/IntellectualSites/PlotSquared.git")
180-
developerConnection.set("scm:git:[email protected]:IntellectualSites/PlotSquared.git")
181-
tag.set("${project.version}")
182-
}
183-
184-
issueManagement {
185-
system.set("GitHub")
186-
url.set("https://github.com/IntellectualSites/PlotSquared/issues")
187-
}
125+
mavenPublishing {
126+
coordinates(
127+
groupId = "$group",
128+
artifactId = project.name,
129+
version = "${project.version}",
130+
)
131+
132+
pom {
133+
name.set(project.name)
134+
description.set("PlotSquared, a land and world management plugin for Minecraft.")
135+
url.set("https://github.com/IntellectualSites/PlotSquared")
136+
137+
licenses {
138+
license {
139+
name.set("GNU General Public License, Version 3.0")
140+
url.set("https://www.gnu.org/licenses/gpl-3.0.html")
141+
distribution.set("repo")
188142
}
189143
}
144+
145+
developers {
146+
developer {
147+
id.set("Sauilitired")
148+
name.set("Alexander Söderberg")
149+
organization.set("IntellectualSites")
150+
organizationUrl.set("https://github.com/IntellectualSites")
151+
}
152+
developer {
153+
id.set("NotMyFault")
154+
name.set("Alexander Brandes")
155+
organization.set("IntellectualSites")
156+
organizationUrl.set("https://github.com/IntellectualSites")
157+
email.set("contact(at)notmyfault.dev")
158+
}
159+
developer {
160+
id.set("SirYwell")
161+
name.set("Hannes Greule")
162+
organization.set("IntellectualSites")
163+
organizationUrl.set("https://github.com/IntellectualSites")
164+
}
165+
developer {
166+
id.set("dordsor21")
167+
name.set("dordsor21")
168+
organization.set("IntellectualSites")
169+
organizationUrl.set("https://github.com/IntellectualSites")
170+
}
171+
}
172+
173+
scm {
174+
url.set("https://github.com/IntellectualSites/PlotSquared")
175+
connection.set("scm:git:https://github.com/IntellectualSites/PlotSquared.git")
176+
developerConnection.set("scm:git:[email protected]:IntellectualSites/PlotSquared.git")
177+
tag.set("${project.version}")
178+
}
179+
180+
issueManagement {
181+
system.set("GitHub")
182+
url.set("https://github.com/IntellectualSites/PlotSquared/issues")
183+
}
184+
185+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
190186
}
191187
}
192188

193189
tasks {
194190

195191
compileJava {
196192
options.compilerArgs.add("-parameters")
197-
options.isDeprecation = true
198193
options.encoding = "UTF-8"
199194
}
200195

@@ -217,15 +212,6 @@ subprojects {
217212
}
218213
}
219214

220-
nexusPublishing {
221-
this.repositories {
222-
sonatype {
223-
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
224-
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
225-
}
226-
}
227-
}
228-
229215
tasks.getByName<Jar>("jar") {
230216
enabled = false
231217
}

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ serverlib = "2.3.7"
3636
shadow = "8.3.6"
3737
grgit = "4.1.1"
3838
spotless = "7.0.3"
39-
nexus = "2.0.0"
39+
publish = "0.31.0"
4040
runPaper = "2.3.1"
4141

4242
[libraries]
@@ -81,5 +81,5 @@ serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.re
8181
shadow = { id = "com.gradleup.shadow", version.ref = "shadow" }
8282
grgit = { id = "org.ajoberstar.grgit", version.ref = "grgit" }
8383
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
84-
nexus = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
84+
publish = { id = "com.vanniktech.maven.publish", version.ref = "publish" }
8585
runPaper = { id = "xyz.jpenilla.run-paper", version.ref = "runPaper" }

0 commit comments

Comments
 (0)