From 00728b650bb7f3c10a3b7e6c397da0c2d278454c Mon Sep 17 00:00:00 2001 From: ix0rai Date: Mon, 16 Sep 2024 11:54:12 -0500 Subject: [PATCH] add automatic publishing --- CHANGELOG.md | 0 build.gradle | 48 +++++++++++++++++++++++++++++++++++++++-------- gradle.properties | 6 +++++- 3 files changed, 45 insertions(+), 9 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..e69de29b diff --git a/build.gradle b/build.gradle index 50a26d4e..8adc53e4 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id "com.github.johnrengelman.shadow" version "7.1.2" id "java-library" id "maven-publish" + id "me.modmuss50.mod-publish-plugin" version "0.5.2" } int javaVersion = Integer.parseInt(project.java_version) @@ -10,14 +11,6 @@ int javaVersion = Integer.parseInt(project.java_version) sourceCompatibility = javaVersion targetCompatibility = javaVersion -loom { - runs { - client { - vmArgs "-Dfabric-tag-conventions-v1.legacyTagWarning=DEV_VERBOSE -Dfabric-tag-conventions-v2.missingTagTranslationWarning=VERBOSE" - } - } -} - repositories { maven { url = "https://maven.gegy.dev/" } maven { url = "https://maven.terraformersmc.com/releases/" } @@ -52,6 +45,45 @@ dependencies { modImplementation("net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}") } +publishMods { + displayName = "bodacious berries ${project.version}" + file = remapJar.archiveFile + changelog = rootProject.file("CHANGELOG.md").getText() + type = STABLE + + modLoaders.add("quilt") + modLoaders.add("fabric") + + dryRun = !providers.environmentVariable("MODRINTH_TOKEN").isPresent() + || !providers.environmentVariable("CURSEFORGE_TOKEN").isPresent() + || property("pub.should_publish") == "false" + dryRun = false + + var mcVersions = [project.minecraft_version] + mcVersions.addAll(property("pub.additional_versions").toString().split(" ").findAll { !it.empty }) + + modrinth { + projectId = "KEFyvbuH" + accessToken = providers.environmentVariable("MODRINTH_TOKEN") + mcVersions.forEach(minecraftVersions::add) + + requires("fabric-api") + optional("modmenu") + } + + curseforge { + accessToken = providers.environmentVariable("CURSEFORGE_TOKEN") + projectId = "576755" + mcVersions.forEach(minecraftVersions::add) + + clientRequired = true + serverRequired = true + + requires("fabric-api") + optional("modmenu") + } +} + tasks.withType(JavaCompile).configureEach { it.options.encoding = 'UTF-8' it.options.deprecation(true) diff --git a/gradle.properties b/gradle.properties index ce14f85b..bc2c0b5b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,8 @@ emi_version=1.1.10+1.21 mod_menu_version=11.0.1 # other dependencies -night_config_version=3.8.1 \ No newline at end of file +night_config_version=3.8.1 + +# publishing +pub.should_publish = true +pub.additional_versions = 1.21 \ No newline at end of file