Fix: readme not being synched to modrinth, publish spigot/bungee/velocity variants to modrinth (#4761)

* Fix: readme not being synched to modrinth

* use new build_number system env var

* also upload bungee/spigot/velocity

* change name

* undo debug mode, oops
This commit is contained in:
chris 2024-06-17 21:31:54 +02:00 committed by GitHub
parent 29928c2d83
commit 77fa37ff82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 76 additions and 32 deletions

View file

@ -103,19 +103,12 @@ jobs:
bootstrap/viaproxy/build/libs/Geyser-ViaProxy.jar bootstrap/viaproxy/build/libs/Geyser-ViaProxy.jar
changelog: ${{ steps.metadata.outputs.body }} changelog: ${{ steps.metadata.outputs.body }}
- name: Publish to Modrinth (Fabric) - name: Publish to Modrinth
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }} if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
env: env:
BUILD_NUMBER: ${{ steps.release-info.outputs.curentRelease }} BUILD_NUMBER: ${{ steps.release-info.outputs.curentRelease }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew fabric:modrinth run: ./gradlew modrinth
- name: Publish to Modrinth (NeoForge)
if: ${{ success() && github.repository == 'GeyserMC/Geyser' && github.ref_name == 'master' }}
env:
BUILD_NUMBER: ${{ steps.release-info.outputs.curentRelease }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
run: ./gradlew neoforge:modrinth
- name: Notify Discord - name: Notify Discord
if: ${{ (success() || failure()) && github.repository == 'GeyserMC/Geyser' }} if: ${{ (success() || failure()) && github.repository == 'GeyserMC/Geyser' }}

View file

@ -34,3 +34,8 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
exclude(dependency("io.netty:netty-resolver-dns:.*")) exclude(dependency("io.netty:netty-resolver-dns:.*"))
} }
} }
modrinth {
uploadFile.set(tasks.getByPath("shadowJar"))
loaders.add("bungeecord")
}

View file

@ -6,6 +6,13 @@ loom {
mixin.defaultRefmapName.set("geyser-refmap.json") mixin.defaultRefmapName.set("geyser-refmap.json")
} }
afterEvaluate {
// We don't need these
tasks.named("remapModrinthJar").configure {
enabled = false
}
}
dependencies { dependencies {
api(projects.core) api(projects.core)
compileOnly(libs.mixin) compileOnly(libs.mixin)

View file

@ -63,6 +63,7 @@ tasks {
modrinth { modrinth {
loaders.add("fabric") loaders.add("fabric")
uploadFile.set(tasks.getByPath("remapModrinthJar"))
dependencies { dependencies {
required.project("fabric-api") required.project("fabric-api")
} }

View file

@ -55,4 +55,5 @@ tasks {
modrinth { modrinth {
loaders.add("neoforge") loaders.add("neoforge")
uploadFile.set(tasks.getByPath("remapModrinthJar"))
} }

View file

@ -76,3 +76,8 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
exclude(dependency("com.mojang:.*")) exclude(dependency("com.mojang:.*"))
} }
} }
modrinth {
uploadFile.set(tasks.getByPath("shadowJar"))
loaders.addAll("spigot", "paper")
}

View file

@ -69,4 +69,9 @@ tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
exclude(dependency("net.kyori:adventure-text-serializer-legacy:.*")) exclude(dependency("net.kyori:adventure-text-serializer-legacy:.*"))
exclude(dependency("net.kyori:adventure-nbt:.*")) exclude(dependency("net.kyori:adventure-nbt:.*"))
} }
}
modrinth {
uploadFile.set(tasks.getByPath("shadowJar"))
loaders.addAll("velocity")
} }

View file

@ -12,6 +12,9 @@ repositories {
} }
dependencies { dependencies {
// this is OK as long as the same version catalog is used in the main build and build-logic
// see https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation(libs.indra) implementation(libs.indra)
implementation(libs.shadow) implementation(libs.shadow)
implementation(libs.architectury.plugin) implementation(libs.architectury.plugin)

View file

@ -0,0 +1,6 @@
import org.gradle.accessors.dm.LibrariesForLibs
import org.gradle.api.Project
import org.gradle.kotlin.dsl.getByType
val Project.libs: LibrariesForLibs
get() = rootProject.extensions.getByType()

View file

@ -8,7 +8,6 @@ plugins {
id("geyser.publish-conventions") id("geyser.publish-conventions")
id("architectury-plugin") id("architectury-plugin")
id("dev.architectury.loom") id("dev.architectury.loom")
id("com.modrinth.minotaur")
} }
// These are provided by Minecraft/modded platforms already, no need to include them // These are provided by Minecraft/modded platforms already, no need to include them
@ -39,7 +38,7 @@ provided("io.netty", "netty-resolver-dns-native-macos")
provided("org.ow2.asm", "asm") provided("org.ow2.asm", "asm")
architectury { architectury {
minecraft = "1.20.5" minecraft = libs.minecraft.get().version as String
} }
loom { loom {
@ -83,7 +82,7 @@ tasks {
register("remapModrinthJar", RemapJarTask::class) { register("remapModrinthJar", RemapJarTask::class) {
dependsOn(shadowJar) dependsOn(shadowJar)
inputFile.set(shadowJar.get().archiveFile) inputFile.set(shadowJar.get().archiveFile)
archiveVersion.set(project.version.toString() + "+build." + System.getenv("GITHUB_RUN_NUMBER")) archiveVersion.set(project.version.toString() + "+build." + System.getenv("BUILD_NUMBER"))
archiveClassifier.set("") archiveClassifier.set("")
} }
} }
@ -93,7 +92,7 @@ afterEvaluate {
// These are shaded, no need to JiJ them // These are shaded, no need to JiJ them
configurations["shadow"].dependencies.forEach {shadowed -> configurations["shadow"].dependencies.forEach {shadowed ->
println("Not including shadowed dependency: ${shadowed.group}:${shadowed.name}") //println("Not including shadowed dependency: ${shadowed.group}:${shadowed.name}")
providedDependencies.add("${shadowed.group}:${shadowed.name}") providedDependencies.add("${shadowed.group}:${shadowed.name}")
} }
@ -101,16 +100,16 @@ afterEvaluate {
configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep -> configurations["includeTransitive"].resolvedConfiguration.resolvedArtifacts.forEach { dep ->
if (!providedDependencies.contains("${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}") if (!providedDependencies.contains("${dep.moduleVersion.id.group}:${dep.moduleVersion.id.name}")
and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")) { and !providedDependencies.contains("${dep.moduleVersion.id.group}:.*")) {
println("Including dependency via JiJ: ${dep.id}") //println("Including dependency via JiJ: ${dep.id}")
dependencies.add("include", dep.moduleVersion.id.toString()) dependencies.add("include", dep.moduleVersion.id.toString())
} else { } else {
println("Not including ${dep.id} for ${project.name}!") //println("Not including ${dep.id} for ${project.name}!")
} }
} }
} }
dependencies { dependencies {
minecraft("com.mojang:minecraft:1.21") minecraft(libs.minecraft)
mappings(loom.officialMojangMappings()) mappings(loom.officialMojangMappings())
} }
@ -121,18 +120,4 @@ repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/") maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://maven.neoforged.net/releases") maven("https://maven.neoforged.net/releases")
}
modrinth {
token.set(System.getenv("MODRINTH_TOKEN")) // Even though this is the default value, apparently this prevents GitHub Actions caching the token?
projectId.set("wKkoqHrH")
versionNumber.set(project.version as String + "-" + System.getenv("GITHUB_RUN_NUMBER"))
versionType.set("beta")
changelog.set("A changelog can be found at https://github.com/GeyserMC/Geyser/commits")
syncBodyFrom.set(rootProject.file("README.md").readText())
uploadFile.set(tasks.getByPath("remapModrinthJar"))
gameVersions.addAll("1.21")
failSilently.set(true)
} }

View file

@ -0,0 +1,18 @@
plugins {
id("com.modrinth.minotaur")
}
// Ensure that the readme is synched
tasks.modrinth.get().dependsOn(tasks.modrinthSyncBody)
modrinth {
token.set(System.getenv("MODRINTH_TOKEN") ?: "") // Even though this is the default value, apparently this prevents GitHub Actions caching the token?
projectId.set("geyser")
versionNumber.set(project.version as String + "-" + System.getenv("BUILD_NUMBER"))
versionType.set("beta")
changelog.set("A changelog can be found at https://github.com/GeyserMC/Geyser/commits")
gameVersions.add(libs.minecraft.get().version as String)
failSilently.set(true)
syncBodyFrom.set(rootProject.file("README.md").readText())
}

View file

@ -26,6 +26,14 @@ val moddedPlatforms = setOf(
projects.mod projects.mod
).map { it.dependencyProject } ).map { it.dependencyProject }
val modrinthPlatforms = setOf(
projects.bungeecord,
projects.fabric,
projects.neoforge,
projects.spigot,
projects.velocity
).map { it.dependencyProject }
subprojects { subprojects {
apply { apply {
plugin("java-library") plugin("java-library")
@ -38,4 +46,10 @@ subprojects {
in moddedPlatforms -> plugins.apply("geyser.modded-conventions") in moddedPlatforms -> plugins.apply("geyser.modded-conventions")
else -> plugins.apply("geyser.base-conventions") else -> plugins.apply("geyser.base-conventions")
} }
// Not combined with platform-conventions as that also contains
// platforms which we cant publish to modrinth
if (modrinthPlatforms.contains(this)) {
plugins.apply("geyser.modrinth-uploading-conventions")
}
} }

View file

@ -28,12 +28,12 @@ commodore = "2.2"
bungeecord = "a7c6ede" bungeecord = "a7c6ede"
velocity = "3.3.0-SNAPSHOT" velocity = "3.3.0-SNAPSHOT"
viaproxy = "3.2.1" viaproxy = "3.2.1"
fabric-minecraft = "1.21"
fabric-loader = "0.15.11" fabric-loader = "0.15.11"
fabric-api = "0.100.1+1.21" fabric-api = "0.100.1+1.21"
fabric-permissions = "0.2-SNAPSHOT" fabric-permissions = "0.2-SNAPSHOT"
neoforge-minecraft = "21.0.0-beta" neoforge-minecraft = "21.0.0-beta"
mixin = "0.8.5" mixin = "0.8.5"
minecraft = "1.21"
# plugin versions # plugin versions
indra = "3.1.3" indra = "3.1.3"
@ -90,8 +90,9 @@ paper-mojangapi = { group = "io.papermc.paper", name = "paper-mojangapi", versio
mixin = { group = "org.spongepowered", name = "mixin", version.ref = "mixin" } mixin = { group = "org.spongepowered", name = "mixin", version.ref = "mixin" }
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
# Check these on https://modmuss50.me/fabric.html # Check these on https://modmuss50.me/fabric.html
fabric-minecraft = { group = "com.mojang", name = "minecraft", version.ref = "fabric-minecraft" }
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" } fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" } fabric-api = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fabric-api" }
fabric-permissions = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions" } fabric-permissions = { group = "me.lucko", name = "fabric-permissions-api", version.ref = "fabric-permissions" }