mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
ci: Switch deployment to gh actions and use semver & java 17
This commit is contained in:
parent
4b57a34f59
commit
507b8d5e35
41
.github/workflows/build.yml
vendored
41
.github/workflows/build.yml
vendored
@ -7,18 +7,9 @@ jobs:
|
|||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
steps:
|
steps:
|
||||||
- name: "Checkout Repository"
|
- name: "Checkout Repository"
|
||||||
uses: "actions/checkout@v2.3.4"
|
uses: "actions/checkout@v2.4.0"
|
||||||
- name : "Validate Gradle Wrapper"
|
- name : "Validate Gradle Wrapper"
|
||||||
uses : "gradle/wrapper-validation-action@v1.0.4"
|
uses : "gradle/wrapper-validation-action@v1.0.4"
|
||||||
- name: "Grab SHA"
|
|
||||||
uses: "benjlevesque/short-sha@v1.2"
|
|
||||||
id: "short-sha"
|
|
||||||
with:
|
|
||||||
length: "7"
|
|
||||||
- name: "Echo SHA"
|
|
||||||
run: "echo $SHA"
|
|
||||||
env:
|
|
||||||
SHA: "${{ steps.short-sha.outputs.sha }}"
|
|
||||||
- name: "Setup Java"
|
- name: "Setup Java"
|
||||||
uses: "actions/setup-java@v2.3.1"
|
uses: "actions/setup-java@v2.3.1"
|
||||||
with:
|
with:
|
||||||
@ -27,8 +18,30 @@ jobs:
|
|||||||
java-version: "17"
|
java-version: "17"
|
||||||
- name: "Clean Build"
|
- name: "Clean Build"
|
||||||
run: "./gradlew clean build --no-daemon"
|
run: "./gradlew clean build --no-daemon"
|
||||||
- name: Archive Artifacts
|
- name: "Determine release status"
|
||||||
uses: actions/upload-artifact@v2
|
if: "${{ runner.os == 'Linux' }}"
|
||||||
|
run: |
|
||||||
|
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
|
||||||
|
echo "STATUS=snapshot" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "STATUS=release" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: "Publish Release"
|
||||||
|
if: "${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}}"
|
||||||
|
run: "./gradlew publishToSonatype closeSonatypeStagingRepository"
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
||||||
|
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_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"
|
||||||
|
env:
|
||||||
|
ORG_GRADLE_PROJECT_sonatypeUsername: "${{ secrets.SONATYPE_USERNAME }}"
|
||||||
|
ORG_GRADLE_PROJECT_sonatypePassword: "${{ secrets.SONATYPE_PASSWORD }}"
|
||||||
|
- name: "Archive Artifacts"
|
||||||
|
uses: "actions/upload-artifact@v2.2.4"
|
||||||
with:
|
with:
|
||||||
name: FastAsyncWorldEdit-Bukkit-1.17-${{ env.SHA }}
|
name: "FastAsyncWorldEdit-Bukkit-SNAPSHOT"
|
||||||
path: worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-1.17-${{ env.SHA }}.jar
|
path: "worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-*.jar"
|
||||||
|
@ -17,7 +17,8 @@ logger.lifecycle("""
|
|||||||
*******************************************
|
*******************************************
|
||||||
""")
|
""")
|
||||||
|
|
||||||
var rootVersion by extra("1.17")
|
var rootVersion by extra("2.0.0")
|
||||||
|
var snapshot by extra("SNAPSHOT")
|
||||||
var revision: String by extra("")
|
var revision: String by extra("")
|
||||||
var buildNumber by extra("")
|
var buildNumber by extra("")
|
||||||
var date: String by extra("")
|
var date: String by extra("")
|
||||||
@ -27,15 +28,14 @@ ext {
|
|||||||
}
|
}
|
||||||
date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
|
date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
|
||||||
revision = "-${git.head().abbreviatedId}"
|
revision = "-${git.head().abbreviatedId}"
|
||||||
val commit: String? = git.head().abbreviatedId
|
|
||||||
buildNumber = if (project.hasProperty("buildnumber")) {
|
buildNumber = if (project.hasProperty("buildnumber")) {
|
||||||
project.properties["buildnumber"] as String
|
project.properties["buildnumber"] as String
|
||||||
} else {
|
} else {
|
||||||
commit.toString()
|
null.toString() //1.18 TODO: drop classifier if not used, otherwise the version is 'null'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
version = String.format("%s-%s", rootVersion, buildNumber)
|
version = String.format("%s-%s+%s", rootVersion, snapshot, buildNumber)
|
||||||
|
|
||||||
if (!project.hasProperty("gitCommitHash")) {
|
if (!project.hasProperty("gitCommitHash")) {
|
||||||
apply(plugin = "org.ajoberstar.grgit")
|
apply(plugin = "org.ajoberstar.grgit")
|
||||||
|
@ -29,4 +29,5 @@ dependencies {
|
|||||||
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
|
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.0")
|
||||||
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.0")
|
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.0")
|
||||||
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.1.14")
|
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.1.14")
|
||||||
|
implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ fun Project.applyCommonConfiguration() {
|
|||||||
|
|
||||||
plugins.withId("java") {
|
plugins.withId("java") {
|
||||||
the<JavaPluginExtension>().toolchain {
|
the<JavaPluginExtension>().toolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(16))
|
languageVersion.set(JavaLanguageVersion.of(17))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
|
|||||||
val disabledLint = listOf(
|
val disabledLint = listOf(
|
||||||
"processing", "path", "fallthrough", "serial"
|
"processing", "path", "fallthrough", "serial"
|
||||||
)
|
)
|
||||||
options.release.set(11)
|
options.release.set(17)
|
||||||
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
||||||
options.isDeprecation = true
|
options.isDeprecation = true
|
||||||
options.encoding = "UTF-8"
|
options.encoding = "UTF-8"
|
||||||
@ -32,7 +32,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean
|
|||||||
}
|
}
|
||||||
|
|
||||||
configurations.all {
|
configurations.all {
|
||||||
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 16)
|
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
tasks.withType<Test>().configureEach {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
import io.github.gradlenexus.publishplugin.NexusPublishExtension
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.artifacts.ExternalModuleDependency
|
import org.gradle.api.artifacts.ExternalModuleDependency
|
||||||
@ -21,6 +22,8 @@ import org.gradle.kotlin.dsl.invoke
|
|||||||
import org.gradle.kotlin.dsl.named
|
import org.gradle.kotlin.dsl.named
|
||||||
import org.gradle.kotlin.dsl.provideDelegate
|
import org.gradle.kotlin.dsl.provideDelegate
|
||||||
import org.gradle.kotlin.dsl.register
|
import org.gradle.kotlin.dsl.register
|
||||||
|
import org.gradle.plugins.signing.SigningExtension
|
||||||
|
import java.net.URI
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
fun Project.applyLibrariesConfiguration() {
|
fun Project.applyLibrariesConfiguration() {
|
||||||
@ -28,6 +31,8 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
apply(plugin = "java-base")
|
apply(plugin = "java-base")
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
apply(plugin = "com.github.johnrengelman.shadow")
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
apply(plugin = "signing")
|
||||||
|
apply(plugin = "io.github.gradle-nexus.publish-plugin")
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
create("shade")
|
create("shade")
|
||||||
@ -112,7 +117,7 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11)
|
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
|
||||||
}
|
}
|
||||||
outgoing.artifact(tasks.named("jar"))
|
outgoing.artifact(tasks.named("jar"))
|
||||||
}
|
}
|
||||||
@ -127,7 +132,7 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.SHADOWED))
|
||||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 11)
|
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 17)
|
||||||
}
|
}
|
||||||
outgoing.artifact(tasks.named("jar"))
|
outgoing.artifact(tasks.named("jar"))
|
||||||
}
|
}
|
||||||
@ -158,6 +163,16 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
mapToMavenScope("runtime")
|
mapToMavenScope("runtime")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure<SigningExtension> {
|
||||||
|
if (!version.toString().endsWith("-SNAPSHOT")) {
|
||||||
|
val signingKey: String? by project
|
||||||
|
val signingPassword: String? by project
|
||||||
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||||
|
isRequired
|
||||||
|
sign(tasks["publications"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
publications {
|
publications {
|
||||||
register<MavenPublication>("maven") {
|
register<MavenPublication>("maven") {
|
||||||
@ -212,31 +227,13 @@ fun Project.applyLibrariesConfiguration() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<NexusPublishExtension> {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
sonatype {
|
||||||
val nexusUsername: String? by project
|
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
|
||||||
val nexusPassword: String? by project
|
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
||||||
if (nexusUsername != null && nexusPassword != null) {
|
|
||||||
maven {
|
|
||||||
val releasesRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/releases/"
|
|
||||||
val snapshotRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/snapshots/"
|
|
||||||
/* Commenting this out for now - Fawe currently does not user semver or any sort of versioning that
|
|
||||||
differentiates between snapshots and releases, API & (past) deployment wise, this will come with a next major release.
|
|
||||||
url = uri(
|
|
||||||
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
|
|
||||||
else releasesRepositoryUrl
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
url = uri(releasesRepositoryUrl)
|
|
||||||
|
|
||||||
credentials {
|
|
||||||
username = nexusUsername
|
|
||||||
password = nexusPassword
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,9 @@ import org.gradle.kotlin.dsl.named
|
|||||||
import org.gradle.kotlin.dsl.provideDelegate
|
import org.gradle.kotlin.dsl.provideDelegate
|
||||||
import org.gradle.kotlin.dsl.register
|
import org.gradle.kotlin.dsl.register
|
||||||
import org.gradle.kotlin.dsl.the
|
import org.gradle.kotlin.dsl.the
|
||||||
|
import org.gradle.plugins.signing.SigningExtension
|
||||||
|
import io.github.gradlenexus.publishplugin.NexusPublishExtension
|
||||||
|
import java.net.URI
|
||||||
|
|
||||||
fun Project.applyPlatformAndCoreConfiguration() {
|
fun Project.applyPlatformAndCoreConfiguration() {
|
||||||
applyCommonConfiguration()
|
applyCommonConfiguration()
|
||||||
@ -20,6 +23,8 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
apply(plugin = "idea")
|
apply(plugin = "idea")
|
||||||
apply(plugin = "maven-publish")
|
apply(plugin = "maven-publish")
|
||||||
apply(plugin = "com.github.johnrengelman.shadow")
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
apply(plugin = "signing")
|
||||||
|
apply(plugin = "io.github.gradle-nexus.publish-plugin")
|
||||||
|
|
||||||
applyCommonJavaConfiguration(
|
applyCommonJavaConfiguration(
|
||||||
sourcesJar = name in setOf("worldedit-core", "worldedit-bukkit"),
|
sourcesJar = name in setOf("worldedit-core", "worldedit-bukkit"),
|
||||||
@ -45,6 +50,16 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
skip()
|
skip()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configure<SigningExtension> {
|
||||||
|
if (!version.toString().endsWith("-SNAPSHOT")) {
|
||||||
|
val signingKey: String? by project
|
||||||
|
val signingPassword: String? by project
|
||||||
|
useInMemoryPgpKeys(signingKey, signingPassword)
|
||||||
|
isRequired
|
||||||
|
sign(tasks["publications"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configure<PublishingExtension> {
|
configure<PublishingExtension> {
|
||||||
publications {
|
publications {
|
||||||
register<MavenPublication>("maven") {
|
register<MavenPublication>("maven") {
|
||||||
@ -99,31 +114,13 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
configure<NexusPublishExtension> {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
sonatype {
|
||||||
val nexusUsername: String? by project
|
nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/"))
|
||||||
val nexusPassword: String? by project
|
snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
|
||||||
if (nexusUsername != null && nexusPassword != null) {
|
|
||||||
maven {
|
|
||||||
val releasesRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/releases/"
|
|
||||||
val snapshotRepositoryUrl = "https://mvn.intellectualsites.com/content/repositories/snapshots/"
|
|
||||||
/* Commenting this out for now - Fawe currently does not user semver or any sort of versioning that
|
|
||||||
differentiates between snapshots and releases, API & (past) deployment wise, this will come with a next major release.
|
|
||||||
url = uri(
|
|
||||||
if (version.toString().endsWith("-SNAPSHOT")) snapshotRepositoryUrl
|
|
||||||
else releasesRepositoryUrl
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
url = uri(releasesRepositoryUrl)
|
|
||||||
|
|
||||||
credentials {
|
|
||||||
username = nexusUsername
|
|
||||||
password = nexusPassword
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.warn("No nexus repository is added; nexusUsername or nexusPassword is null.")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user