-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Like all publishing code, we'll only find out if it works when we run it!
- Loading branch information
Showing
8 changed files
with
76 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
buildSrc/src/main/kotlin/cc-tweaked.mod-publishing.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ plugins { | |
id("cc-tweaked.publishing") | ||
} | ||
|
||
val mcVersion: String by extra | ||
|
||
java { | ||
withJavadocJar() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters