mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-12 19:20:29 +00:00
Publish Fabric jars to CF/Modrinth
Like all publishing code, we'll only find out if it works when we run it!
This commit is contained in:
parent
986c65f56e
commit
266182996d
@ -47,9 +47,11 @@ dependencies {
|
|||||||
implementation(libs.kotlin.plugin)
|
implementation(libs.kotlin.plugin)
|
||||||
implementation(libs.spotless)
|
implementation(libs.spotless)
|
||||||
|
|
||||||
|
implementation(libs.curseForgeGradle)
|
||||||
implementation(libs.fabric.loom)
|
implementation(libs.fabric.loom)
|
||||||
implementation(libs.forgeGradle)
|
implementation(libs.forgeGradle)
|
||||||
implementation(libs.librarian)
|
implementation(libs.librarian)
|
||||||
|
implementation(libs.minotaur)
|
||||||
implementation(libs.quiltflower)
|
implementation(libs.quiltflower)
|
||||||
implementation(libs.vanillaGradle)
|
implementation(libs.vanillaGradle)
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
// SPDX-FileCopyrightText: 2023 The CC: Tweaked Developers
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
|
import net.darkhax.curseforgegradle.TaskPublishCurseForge
|
||||||
|
import cc.tweaked.gradle.setProvider
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("net.darkhax.curseforgegradle")
|
||||||
|
id("com.modrinth.minotaur")
|
||||||
|
id("cc-tweaked.publishing")
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class ModPublishingExtension {
|
||||||
|
abstract val output: Property<AbstractArchiveTask>
|
||||||
|
|
||||||
|
init {
|
||||||
|
output.finalizeValueOnRead()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val modPublishing = project.extensions.create("modPublishing", ModPublishingExtension::class.java)
|
||||||
|
|
||||||
|
val isUnstable = project.properties["isUnstable"] == "true"
|
||||||
|
val modVersion: String by extra
|
||||||
|
val mcVersion: String by extra
|
||||||
|
|
||||||
|
val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) {
|
||||||
|
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
||||||
|
description = "Upload artifacts to CurseForge"
|
||||||
|
|
||||||
|
apiToken = findProperty("curseForgeApiKey") ?: ""
|
||||||
|
enabled = apiToken != ""
|
||||||
|
|
||||||
|
val mainFile = upload("282001", modPublishing.output.get().archiveFile)
|
||||||
|
dependsOn(modPublishing.output) // See https://github.com/Darkhax/CurseForgeGradle/pull/7.
|
||||||
|
mainFile.changelog =
|
||||||
|
"Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)."
|
||||||
|
mainFile.changelogType = "markdown"
|
||||||
|
mainFile.releaseType = if (isUnstable) "alpha" else "release"
|
||||||
|
mainFile.gameVersions.add(mcVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.publish { dependsOn(publishCurseForge) }
|
||||||
|
|
||||||
|
modrinth {
|
||||||
|
token.set(findProperty("modrinthApiKey") as String? ?: "")
|
||||||
|
projectId.set("gu7yAYhd")
|
||||||
|
versionNumber.set("$mcVersion-$modVersion")
|
||||||
|
versionName.set(modVersion)
|
||||||
|
versionType.set(if (isUnstable) "alpha" else "release")
|
||||||
|
uploadFile.setProvider(modPublishing.output)
|
||||||
|
gameVersions.add(mcVersion)
|
||||||
|
changelog.set("Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion).")
|
||||||
|
|
||||||
|
syncBodyFrom.set(provider { file("doc/mod-page.md").readText() })
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.publish { dependsOn(tasks.modrinth) }
|
@ -5,6 +5,8 @@
|
|||||||
package cc.tweaked.gradle
|
package cc.tweaked.gradle
|
||||||
|
|
||||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
import org.gradle.api.tasks.JavaExec
|
import org.gradle.api.tasks.JavaExec
|
||||||
import org.gradle.process.BaseExecSpec
|
import org.gradle.process.BaseExecSpec
|
||||||
import org.gradle.process.JavaExecSpec
|
import org.gradle.process.JavaExecSpec
|
||||||
@ -119,3 +121,6 @@ class CloseScope : AutoCloseable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Proxy method to avoid overload ambiguity. */
|
||||||
|
fun <T> Property<T>.setProvider(provider: Provider<out T>) = set(provider)
|
||||||
|
@ -7,8 +7,6 @@ SPDX-License-Identifier: MPL-2.0
|
|||||||
# ![CC: Tweaked](https://tweaked.cc/logo.png)
|
# ![CC: Tweaked](https://tweaked.cc/logo.png)
|
||||||
CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the much-beloved [ComputerCraft], it continues its legacy with better performance, stability, and a wealth of new features.
|
CC: Tweaked is a mod for Minecraft which adds programmable computers, turtles and more to the game. A fork of the much-beloved [ComputerCraft], it continues its legacy with better performance, stability, and a wealth of new features.
|
||||||
|
|
||||||
**Fabric support is added by the [CC: Restitched][ccrestitched] project**
|
|
||||||
|
|
||||||
## Testimonials
|
## Testimonials
|
||||||
|
|
||||||
> I'm not sure what that is [...] I don't know where that came from.
|
> I'm not sure what that is [...] I don't know where that came from.
|
||||||
|
@ -115,6 +115,7 @@ slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
|
|||||||
# Build tools
|
# Build tools
|
||||||
cctJavadoc = { module = "cc.tweaked:cct-javadoc", version.ref = "cctJavadoc" }
|
cctJavadoc = { module = "cc.tweaked:cct-javadoc", version.ref = "cctJavadoc" }
|
||||||
checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
|
checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
|
||||||
|
curseForgeGradle = { module = "net.darkhax.curseforgegradle:CurseForgeGradle", version.ref = "curseForgeGradle" }
|
||||||
errorProne-annotations = { module = "com.google.errorprone:error_prone_annotations", version.ref = "errorProne-core" }
|
errorProne-annotations = { module = "com.google.errorprone:error_prone_annotations", version.ref = "errorProne-core" }
|
||||||
errorProne-api = { module = "com.google.errorprone:error_prone_check_api", version.ref = "errorProne-core" }
|
errorProne-api = { module = "com.google.errorprone:error_prone_check_api", version.ref = "errorProne-core" }
|
||||||
errorProne-core = { module = "com.google.errorprone:error_prone_core", version.ref = "errorProne-core" }
|
errorProne-core = { module = "com.google.errorprone:error_prone_core", version.ref = "errorProne-core" }
|
||||||
@ -124,19 +125,18 @@ fabric-loom = { module = "net.fabricmc:fabric-loom", version.ref = "fabric-loom"
|
|||||||
forgeGradle = { module = "net.minecraftforge.gradle:ForgeGradle", version.ref = "forgeGradle" }
|
forgeGradle = { module = "net.minecraftforge.gradle:ForgeGradle", version.ref = "forgeGradle" }
|
||||||
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
kotlin-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||||
librarian = { module = "org.parchmentmc:librarian", version.ref = "librarian" }
|
librarian = { module = "org.parchmentmc:librarian", version.ref = "librarian" }
|
||||||
|
minotaur = { module = "com.modrinth.minotaur:Minotaur", version.ref = "minotaur" }
|
||||||
nullAway = { module = "com.uber.nullaway:nullaway", version.ref = "nullAway" }
|
nullAway = { module = "com.uber.nullaway:nullaway", version.ref = "nullAway" }
|
||||||
quiltflower = { module = "io.github.juuxel:loom-quiltflower", version.ref = "quiltflower" }
|
quiltflower = { module = "io.github.juuxel:loom-quiltflower", version.ref = "quiltflower" }
|
||||||
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" }
|
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" }
|
||||||
vanillaGradle = { module = "org.spongepowered:vanillagradle", version.ref = "vanillaGradle" }
|
vanillaGradle = { module = "org.spongepowered:vanillagradle", version.ref = "vanillaGradle" }
|
||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
curseForgeGradle = { id = "net.darkhax.curseforgegradle", version.ref = "curseForgeGradle" }
|
|
||||||
forgeGradle = { id = "net.minecraftforge.gradle", version.ref = "forgeGradle" }
|
forgeGradle = { id = "net.minecraftforge.gradle", version.ref = "forgeGradle" }
|
||||||
githubRelease = { id = "com.github.breadmoirai.github-release", version.ref = "githubRelease" }
|
githubRelease = { id = "com.github.breadmoirai.github-release", version.ref = "githubRelease" }
|
||||||
ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "ideaExt" }
|
ideaExt = { id = "org.jetbrains.gradle.plugin.idea-ext", version.ref = "ideaExt" }
|
||||||
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
librarian = { id = "org.parchmentmc.librarian.forgegradle", version.ref = "librarian" }
|
librarian = { id = "org.parchmentmc.librarian.forgegradle", version.ref = "librarian" }
|
||||||
minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" }
|
|
||||||
mixinGradle = { id = "org.spongepowered.mixin", version.ref = "mixinGradle" }
|
mixinGradle = { id = "org.spongepowered.mixin", version.ref = "mixinGradle" }
|
||||||
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
|
||||||
taskTree = { id = "com.dorongold.task-tree", version.ref = "taskTree" }
|
taskTree = { id = "com.dorongold.task-tree", version.ref = "taskTree" }
|
||||||
|
@ -7,8 +7,6 @@ plugins {
|
|||||||
id("cc-tweaked.publishing")
|
id("cc-tweaked.publishing")
|
||||||
}
|
}
|
||||||
|
|
||||||
val mcVersion: String by extra
|
|
||||||
|
|
||||||
java {
|
java {
|
||||||
withJavadocJar()
|
withJavadocJar()
|
||||||
}
|
}
|
||||||
|
@ -9,11 +9,10 @@ import java.util.*
|
|||||||
plugins {
|
plugins {
|
||||||
id("cc-tweaked.fabric")
|
id("cc-tweaked.fabric")
|
||||||
id("cc-tweaked.gametest")
|
id("cc-tweaked.gametest")
|
||||||
id("cc-tweaked.publishing")
|
id("cc-tweaked.mod-publishing")
|
||||||
}
|
}
|
||||||
|
|
||||||
val modVersion: String by extra
|
val modVersion: String by extra
|
||||||
val mcVersion: String by extra
|
|
||||||
|
|
||||||
val allProjects = listOf(":core-api", ":core", ":fabric-api").map { evaluationDependsOn(it) }
|
val allProjects = listOf(":core-api", ":core", ":fabric-api").map { evaluationDependsOn(it) }
|
||||||
cct {
|
cct {
|
||||||
@ -231,6 +230,10 @@ tasks.register("checkClient") {
|
|||||||
dependsOn(runGametestClient, runGametestClientWithSodium, runGametestClientWithIris)
|
dependsOn(runGametestClient, runGametestClientWithSodium, runGametestClientWithIris)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
modPublishing {
|
||||||
|
output.set(tasks.remapJar)
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType(GenerateModuleMetadata::class).configureEach { isEnabled = false }
|
tasks.withType(GenerateModuleMetadata::class).configureEach { isEnabled = false }
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
|
@ -3,27 +3,18 @@
|
|||||||
// SPDX-License-Identifier: MPL-2.0
|
// SPDX-License-Identifier: MPL-2.0
|
||||||
|
|
||||||
import cc.tweaked.gradle.*
|
import cc.tweaked.gradle.*
|
||||||
import net.darkhax.curseforgegradle.TaskPublishCurseForge
|
|
||||||
import net.minecraftforge.gradle.common.util.RunConfig
|
import net.minecraftforge.gradle.common.util.RunConfig
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
// Build
|
|
||||||
id("cc-tweaked.forge")
|
id("cc-tweaked.forge")
|
||||||
id("cc-tweaked.gametest")
|
id("cc-tweaked.gametest")
|
||||||
alias(libs.plugins.mixinGradle)
|
alias(libs.plugins.mixinGradle)
|
||||||
alias(libs.plugins.shadow)
|
alias(libs.plugins.shadow)
|
||||||
// Publishing
|
|
||||||
alias(libs.plugins.curseForgeGradle)
|
|
||||||
alias(libs.plugins.minotaur)
|
|
||||||
|
|
||||||
id("cc-tweaked.illuaminate")
|
id("cc-tweaked.illuaminate")
|
||||||
id("cc-tweaked.publishing")
|
id("cc-tweaked.mod-publishing")
|
||||||
id("cc-tweaked")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val isUnstable = project.properties["isUnstable"] == "true"
|
|
||||||
val modVersion: String by extra
|
val modVersion: String by extra
|
||||||
val mcVersion: String by extra
|
|
||||||
|
|
||||||
val allProjects = listOf(":core-api", ":core", ":forge-api").map { evaluationDependsOn(it) }
|
val allProjects = listOf(":core-api", ":core", ":forge-api").map { evaluationDependsOn(it) }
|
||||||
cct {
|
cct {
|
||||||
@ -293,39 +284,10 @@ tasks.register("checkClient") {
|
|||||||
|
|
||||||
// Upload tasks
|
// Upload tasks
|
||||||
|
|
||||||
val publishCurseForge by tasks.registering(TaskPublishCurseForge::class) {
|
modPublishing {
|
||||||
group = PublishingPlugin.PUBLISH_TASK_GROUP
|
output.set(tasks.shadowJar)
|
||||||
description = "Upload artifacts to CurseForge"
|
|
||||||
|
|
||||||
apiToken = findProperty("curseForgeApiKey") ?: ""
|
|
||||||
enabled = apiToken != ""
|
|
||||||
|
|
||||||
val mainFile = upload("282001", tasks.shadowJar.get().archiveFile)
|
|
||||||
dependsOn(tasks.shadowJar) // Ughr.
|
|
||||||
mainFile.changelog =
|
|
||||||
"Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion)."
|
|
||||||
mainFile.changelogType = "markdown"
|
|
||||||
mainFile.releaseType = if (isUnstable) "alpha" else "release"
|
|
||||||
mainFile.gameVersions.add(mcVersion)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.publish { dependsOn(publishCurseForge) }
|
|
||||||
|
|
||||||
modrinth {
|
|
||||||
token.set(findProperty("modrinthApiKey") as String? ?: "")
|
|
||||||
projectId.set("gu7yAYhd")
|
|
||||||
versionNumber.set("$mcVersion-$modVersion")
|
|
||||||
versionName.set(modVersion)
|
|
||||||
versionType.set(if (isUnstable) "alpha" else "release")
|
|
||||||
uploadFile.set(tasks.shadowJar as Any)
|
|
||||||
gameVersions.add(mcVersion)
|
|
||||||
changelog.set("Release notes can be found on the [GitHub repository](https://github.com/cc-tweaked/CC-Tweaked/releases/tag/v$mcVersion-$modVersion).")
|
|
||||||
|
|
||||||
syncBodyFrom.set(provider { file("doc/mod-page.md").readText() })
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.publish { dependsOn(tasks.modrinth) }
|
|
||||||
|
|
||||||
// Don't publish the slim jar
|
// Don't publish the slim jar
|
||||||
for (cfg in listOf(configurations.apiElements, configurations.runtimeElements)) {
|
for (cfg in listOf(configurations.apiElements, configurations.runtimeElements)) {
|
||||||
cfg.configure { artifacts.removeIf { it.classifier == "slim" } }
|
cfg.configure { artifacts.removeIf { it.classifier == "slim" } }
|
||||||
|
Loading…
Reference in New Issue
Block a user