Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
run: chmod +x gradlew

- name: Publish with Gradle
run: ./gradlew eternalcore-api:publish
run: ./gradlew :eternalcore-api:publish
env:
ETERNAL_CODE_MAVEN_USERNAME: ${{ secrets.ETERNAL_CODE_MAVEN_USERNAME }}
ETERNAL_CODE_MAVEN_PASSWORD: ${{ secrets.ETERNAL_CODE_MAVEN_PASSWORD }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ EternalCore is your ultimate companion for enhancing your Minecraft server exper

## ℹ️ Information

- EternalCore fully supports Minecraft's latest minor versions starting from each major version, starting from 1.17 onward, e.g. `1.17.1`, `1.18.2`, `1.19.4`, `1.20.6`, `1.21.8`.
- EternalCore fully supports Minecraft's latest minor versions starting from each major version, starting from 1.19 onward, e.g. `1.19.4`, `1.20.6`, `1.21.11`.
- Requires **Java 21 or later** to work properly. For older versions of Java, this may affect the functionality of the plugin.
- If you have any questions, perhaps you will find a solution to them in our [documentation](https://docs.eternalcode.pl/eternalcore/introduction.html), you can also ask us about it on [discord](https://discord.gg/FQ7jmGBd6c).

Expand Down
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ dependencies {
implementation("com.gradleup.shadow:shadow-gradle-plugin:9.3.1")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.3.0")
implementation("net.minecrell:plugin-yml:0.6.0")
implementation("com.modrinth.minotaur:Minotaur:2.8.10")
implementation("io.papermc.hangar-publish-plugin:io.papermc.hangar-publish-plugin.gradle.plugin:0.1.4")
}

sourceSets {
Expand Down
83 changes: 83 additions & 0 deletions buildSrc/src/main/kotlin/eternalcore-publish-plugin.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import io.papermc.hangarpublishplugin.model.Platforms

plugins {
id("com.gradleup.shadow")
id("com.modrinth.minotaur")
id("io.papermc.hangar-publish-plugin")
}

val buildNumber = providers.environmentVariable("GITHUB_RUN_NUMBER").orNull
val isRelease = providers.environmentVariable("GITHUB_EVENT_NAME").orNull == "release"

if (buildNumber != null && !isRelease) {
val offset = try {
val description = providers.exec {
commandLine("git", "describe", "--tags", "--long")
}.standardOutput.asText.get().trim()
val parts = description.split("-")
if (parts.size >= 3) parts[parts.size - 2] else "0"
} catch (e: Exception) {
try {
providers.exec {
commandLine("git", "rev-list", "--count", "HEAD")
}.standardOutput.asText.get().trim()
} catch (e: Exception) {
"0"
}
}

val baseVersion = project.version.toString().replace("-SNAPSHOT", "")
version = "$baseVersion-SNAPSHOT+$offset"
}

val changelogText = providers.environmentVariable("CHANGELOG").orElse(providers.exec {
commandLine("git", "log", "-1", "--format=%B")
}.standardOutput.asText)

logger.lifecycle("Building version: $version")

val paperVersions = (property("paperVersion") as String)
.split(",")
.map { it.trim() }

val hangarToken = providers.environmentVariable("HANGAR_API_TOKEN")
.orElse(providers.gradleProperty("hangarToken"))

val projectVersion = project.version.toString()
val releaseChannel = if (isRelease) "Release" else "Snapshot"

afterEvaluate {
val shadowJarTask = tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar")

modrinth {
token.set(providers.environmentVariable("MODRINTH_TOKEN"))
projectId.set(project.findProperty("modrinthProjectId") as String? ?: project.name)
versionNumber.set(projectVersion)
versionType.set(if (isRelease) "release" else "beta")
uploadFile.set(shadowJarTask)
gameVersions.addAll(paperVersions)
loaders.addAll(listOf("paper", "folia", "purpur"))
changelog.set(changelogText)

val readmeFile = rootProject.file("README.md")
if (readmeFile.exists()) {
syncBodyFrom.set(readmeFile.readText())
}
}

hangarPublish {
publications.register("plugin") {
version.set(projectVersion)
channel.set(releaseChannel)
changelog.set(changelogText)
id.set(project.findProperty("hangarProjectId") as String? ?: project.name)
apiKey.set(hangarToken)
platforms {
register(Platforms.PAPER) {
jar.set(shadowJarTask.flatMap { it.archiveFile })
platformVersions.set(paperVersions)
}
}
}
}
}
7 changes: 7 additions & 0 deletions eternalcore-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ plugins {
`eternalcode-java`
`eternalcore-repositories`
`eternalcore-shadow-compiler`
`eternalcore-publish-plugin`
id("xyz.jpenilla.run-paper") version "3.0.2"
}

ext {
set("modrinthProjectId", "eternalcore")
set("hangarProjectId", "eternalcore")
}

eternalShadowCompiler {
module(":eternalcore-core")

Expand Down Expand Up @@ -40,3 +46,4 @@ tasks {
downloadPlugins.modrinth("luckperms", "v${Versions.LUCKPERMS}-bukkit")
}
}

3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true

# Platforms
paperVersion=1.19.4,1.20,1.20.1,1.20.2,1.20.3,1.20.4,1.20.5,1.20.6,1.21,1.21.1,1.21.2,1.21.3,1.21.4,1.21.5,1.21.6,1.21.7,1.21.8,1.21.9,1.21.10,1.21.11