|
| 1 | +import me.modmuss50.mpp.ModPublishExtension |
| 2 | +import me.modmuss50.mpp.PublishModTask |
| 3 | + |
1 | 4 | plugins { |
2 | 5 | id("java-library") |
3 | 6 | id("maven-publish") |
4 | 7 |
|
5 | 8 | alias(libs.plugins.pluginyml.bukkit) |
6 | 9 | alias(libs.plugins.run.paper) |
7 | 10 | alias(libs.plugins.shadow) |
| 11 | + alias(libs.plugins.publishing) |
8 | 12 | } |
9 | 13 |
|
10 | 14 | group = "dev.booky" |
11 | | -version = "1.10.4-SNAPSHOT" |
12 | 15 |
|
13 | 16 | val plugin: Configuration by configurations.creating { |
14 | 17 | isTransitive = false |
@@ -91,3 +94,51 @@ tasks { |
91 | 94 | dependsOn(shadowJar) |
92 | 95 | } |
93 | 96 | } |
| 97 | + |
| 98 | +configure<ModPublishExtension> { |
| 99 | + val repositoryName = "CloudCraftProjects/CraftAttack" |
| 100 | + changelog = "See https://github.com/$repositoryName/releases/tag/v${project.version}" |
| 101 | + type = if (project.version.toString().endsWith("-SNAPSHOT")) BETA else STABLE |
| 102 | + dryRun = !hasProperty("noDryPublish") |
| 103 | + |
| 104 | + file = tasks.named<Jar>("shadowJar").flatMap { it.archiveFile } |
| 105 | + additionalFiles.from(tasks.named<Jar>("sourcesJar")) |
| 106 | + |
| 107 | + github { |
| 108 | + accessToken = providers.environmentVariable("GITHUB_API_TOKEN") |
| 109 | + .orElse(providers.gradleProperty("ccGithubToken")) |
| 110 | + |
| 111 | + displayName = "${rootProject.name} v${project.version}" |
| 112 | + |
| 113 | + repository = repositoryName |
| 114 | + commitish = "master" |
| 115 | + tagName = "v${project.version}" |
| 116 | + |
| 117 | + if (project != rootProject) { |
| 118 | + parent(rootProject.tasks.named("publishGithub")) |
| 119 | + } |
| 120 | + } |
| 121 | + modrinth { |
| 122 | + accessToken = providers.environmentVariable("MODRINTH_API_TOKEN") |
| 123 | + .orElse(providers.gradleProperty("ccModrinthToken")) |
| 124 | + |
| 125 | + version = "${project.version}" |
| 126 | + displayName = "${rootProject.name} v${project.version}" |
| 127 | + modLoaders.add("paper") |
| 128 | + |
| 129 | + projectId = "xA2xhZUF" |
| 130 | + minecraftVersionRange { |
| 131 | + start = rootProject.libs.versions.paper.get().split("-")[0] |
| 132 | + end = "latest" |
| 133 | + } |
| 134 | + |
| 135 | + requires("commandapi", "cloudcore") |
| 136 | + // even though luckperms doesn't publish paper jars on modrinth, add it as optional |
| 137 | + optional("launchplates", "luckperms") |
| 138 | + } |
| 139 | +} |
| 140 | + |
| 141 | +tasks.withType<PublishModTask> { |
| 142 | + dependsOn(tasks.named<Jar>("shadowJar")) |
| 143 | + dependsOn(tasks.named<Jar>("sourcesJar")) |
| 144 | +} |
0 commit comments