From 98ccd9f7f46d02398789d645bce8d1d67c7a371b Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Wed, 28 Aug 2024 10:41:26 +0100 Subject: [PATCH] build: use MPP for publishing --- build.gradle | 44 +++++++++++++++++++++++++++++++++++++++++++- fabric/build.gradle | 2 -- forge/build.gradle | 2 -- gradle.properties | 1 + 4 files changed, 44 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 709a021..9167b80 100755 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false + id "me.modmuss50.mod-publish-plugin" version "0.5.1" } architectury { @@ -90,4 +91,45 @@ allprojects { } } -task curseforgePublish \ No newline at end of file +publishMods { + dryRun = providers.environmentVariable("CURSEFORGE_KEY").getOrNull() == null + changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided") + version = "${mod_version}" + + // TODO: Migrate to something else + def tag = providers.environmentVariable("TAG").getOrElse("release") + type = tag.endsWith("-beta") ? BETA : (tag.endsWith("-alpha") ? ALPHA : STABLE) + + def createOptions = (String projectName) -> { + publishOptions { + file = project.provider { project(":$projectName").tasks.remapJar }.flatMap { it.archiveFile } + displayName = "[${projectName.toUpperCase()}][${minecraft_version}] ${readable_name} ${mod_version}" + modLoaders.add(projectName.toLowerCase()) + } + } + + def fabricOptions = createOptions("fabric") + def forgeOptions = createOptions("forge") + + def curseForgeOptions = curseforgeOptions { + accessToken = providers.environmentVariable("CURSEFORGE_KEY") + minecraftVersions.add("${minecraft_version}") + } + + curseforge("curseforgeFabric") { + from(curseForgeOptions, fabricOptions) + projectId = curseforge_id_fabric + requires("fabric-api") + requires("architectury-api") + requires('ftb-library-fabric') + optional('ftb-ranks-fabric') + } + + curseforge("curseforgeForge") { + from(curseForgeOptions, forgeOptions) + projectId = curseforge_id_forge + requires {slug = "architectury-api" } + requires {slug = 'ftb-library-forge' } + optional {slug = 'ftb-ranks-forge' } + } +} \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 53a3ea4..ef086b3 100755 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -102,5 +102,3 @@ publishing { } } } - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/forge/build.gradle b/forge/build.gradle index 023aaf4..dcebff5 100755 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -107,8 +107,6 @@ publishing { } } -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") - // Used to temporarily add mods to the workspace for debugging def customGradle = project.file('custom.gradle') if (customGradle.exists()) { diff --git a/gradle.properties b/gradle.properties index 975b3a6..a6cd666 100755 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false mod_version=1902.4.2 +readable_name=FTB Ultimine maven_group=dev.ftb.mods mod_id=ftbultimine archives_base_name=ftb-ultimine