mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-28 11:44:42 +02:00
build: Overhaul build & deployment workflow (#3267)
* Fixes #3250 * build: Overhaul build & deployment workflow - Move to release drafter - Replace publishing with gradle nexus - Conventional commits are handy - Determine build status in gh actions before deploying
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
|
||||
import org.cadixdev.gradle.licenser.LicenseExtension
|
||||
import org.cadixdev.gradle.licenser.Licenser
|
||||
import java.net.URI
|
||||
|
||||
plugins {
|
||||
java
|
||||
@ -11,22 +12,13 @@ plugins {
|
||||
alias(libs.plugins.shadow)
|
||||
alias(libs.plugins.licenser)
|
||||
alias(libs.plugins.grgit)
|
||||
alias(libs.plugins.nexus)
|
||||
|
||||
eclipse
|
||||
idea
|
||||
}
|
||||
|
||||
var ver by extra("6.1.3")
|
||||
var versuffix by extra("-SNAPSHOT")
|
||||
val versionsuffix: String? by project
|
||||
if (versionsuffix != null) {
|
||||
versuffix = "-$versionsuffix"
|
||||
}
|
||||
version = if (!project.hasProperty("release")) {
|
||||
ver + versuffix
|
||||
} else {
|
||||
ver
|
||||
}
|
||||
version = "6.1.3-SNAPSHOT"
|
||||
|
||||
allprojects {
|
||||
group = "com.plotsquared"
|
||||
@ -103,6 +95,9 @@ allprojects {
|
||||
|
||||
signing {
|
||||
if (!version.toString().endsWith("-SNAPSHOT")) {
|
||||
val signingKey: String? by project
|
||||
val signingPassword: String? by project
|
||||
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||
signing.isRequired
|
||||
sign(publishing.publications)
|
||||
}
|
||||
@ -111,8 +106,6 @@ allprojects {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
// This includes not only the original jar (i.e. not shadowJar),
|
||||
// but also sources & javadocs due to the above java block.
|
||||
from(components["java"])
|
||||
|
||||
pom {
|
||||
@ -133,18 +126,23 @@ allprojects {
|
||||
developer {
|
||||
id.set("Sauilitired")
|
||||
name.set("Alexander Söderberg")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
developer {
|
||||
id.set("NotMyFault")
|
||||
name.set("NotMyFault")
|
||||
organization.set("IntellectualSites")
|
||||
email.set("contact@notmyfault.dev")
|
||||
}
|
||||
developer {
|
||||
id.set("SirYwell")
|
||||
name.set("Hannes Greule")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
developer {
|
||||
id.set("dordsor21")
|
||||
name.set("dordsor21")
|
||||
organization.set("IntellectualSites")
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,34 +159,6 @@ allprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal() // Install to own local repository
|
||||
|
||||
// Accept String? to not err if they're not present.
|
||||
// Check that they both exist before adding the repo, such that
|
||||
// `credentials` doesn't err if one is null.
|
||||
// It's not pretty, but this way it can compile.
|
||||
val nexusUsername: String? by project
|
||||
val nexusPassword: String? by project
|
||||
if (nexusUsername != null && nexusPassword != null) {
|
||||
maven {
|
||||
val releasesRepositoryUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
|
||||
val snapshotRepositoryUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
|
||||
url = uri(
|
||||
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
|
||||
else releasesRepositoryUrl
|
||||
)
|
||||
|
||||
credentials {
|
||||
username = nexusUsername
|
||||
password = nexusPassword
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
@ -217,10 +187,6 @@ allprojects {
|
||||
)
|
||||
}
|
||||
|
||||
jar {
|
||||
this.archiveClassifier.set("jar")
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
this.archiveClassifier.set(null as String?)
|
||||
this.archiveFileName.set("${project.name}-${project.version}.${this.archiveExtension.getOrElse("jar")}")
|
||||
@ -237,6 +203,15 @@ allprojects {
|
||||
|
||||
}
|
||||
|
||||
nexusPublishing {
|
||||
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 {
|
||||
val aggregatedJavadocs = create<Javadoc>("aggregatedJavadocs") {
|
||||
title = "${project.name} ${project.version} API"
|
||||
|
Reference in New Issue
Block a user