|
| 1 | +buildscript { |
| 2 | + dependencies { |
| 3 | + classpath 'org.kohsuke:github-api:1.135' |
| 4 | + } |
| 5 | +} |
| 6 | + |
1 | 7 | plugins {
|
2 | 8 | id 'babric-loom' version '1.4.+'
|
3 | 9 | id 'java'
|
| 10 | + id "com.modrinth.minotaur" version "2.+" |
4 | 11 | }
|
5 | 12 |
|
6 | 13 | group = project.mod_group
|
@@ -58,3 +65,57 @@ remapJar {
|
58 | 65 | archiveVersion.set(archiveVersion.get()+"-${bta_version}")
|
59 | 66 | }
|
60 | 67 |
|
| 68 | +modrinth { |
| 69 | + token = modrinthToken |
| 70 | + projectId = "catalyst" // This can be the project ID or the slug. Either will work! |
| 71 | + versionNumber = project.mod_version // You don't need to set this manually. Will fail if Modrinth has this version already |
| 72 | + versionType = "release" // This is the default -- can also be `beta` or `alpha` |
| 73 | + uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`! |
| 74 | + gameVersions = ["b1.7.3"] // Must be an array, even with only one version |
| 75 | + loaders = ["fabric"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle |
| 76 | + changelog = Files.readString(java.nio.file.Path.of("${project.projectDir}/CHANGELOG.md")) |
| 77 | +} |
| 78 | + |
| 79 | + |
| 80 | +import net.fabricmc.loom.task.RemapJarTask |
| 81 | +import org.kohsuke.github.GHReleaseBuilder |
| 82 | +import org.kohsuke.github.GitHub |
| 83 | + |
| 84 | +import java.nio.file.Files |
| 85 | + |
| 86 | +tasks.register('github') { |
| 87 | + doLast { |
| 88 | + |
| 89 | + List<RemapJarTask> ts = List.of( |
| 90 | + rootProject.project(":catalyst").project("energy").remapJar as RemapJarTask, |
| 91 | + rootProject.project(":catalyst").project("fluids").remapJar as RemapJarTask, |
| 92 | + rootProject.project(":catalyst").project("multiblocks").remapJar as RemapJarTask, |
| 93 | + rootProject.project(":catalyst").project("effects").remapJar as RemapJarTask, |
| 94 | + rootProject.project(":catalyst").project("multipart").remapJar as RemapJarTask |
| 95 | + ) |
| 96 | + |
| 97 | + def github = GitHub.connectUsingOAuth(githubToken as String) |
| 98 | + def repository = github.getRepository("MartinSVK12/catalyst") |
| 99 | + |
| 100 | + def releaseBuilder = new GHReleaseBuilder(repository, version as String) |
| 101 | + releaseBuilder.name("$version") |
| 102 | + releaseBuilder.body(Files.readString(java.nio.file.Path.of("${rootProject.projectDir}/CHANGELOG.md"))) |
| 103 | + releaseBuilder.commitish("bta") |
| 104 | + releaseBuilder.prerelease(true) |
| 105 | + |
| 106 | + def release = releaseBuilder.create() |
| 107 | + release.uploadAsset(project.file(remapJar.getArchiveFile().get().getAsFile()),"application/java-archive") |
| 108 | + if(findProject(":catalyst") != null){ |
| 109 | + ts.forEach { |
| 110 | + release.uploadAsset(project.file(it.getArchiveFile().get().getAsFile()),"application/java-archive") |
| 111 | + } |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | + |
| 116 | +tasks.register('deploy'){ |
| 117 | + description "Publish mod to modrinth and github." |
| 118 | + group "publishing" |
| 119 | + dependsOn modrinth |
| 120 | + dependsOn github |
| 121 | +} |
0 commit comments