11plugins {
22 id " architectury-plugin" version " 3.4-SNAPSHOT"
33 id " dev.architectury.loom" version " 0.12.0-SNAPSHOT" apply false
4+ id " me.modmuss50.mod-publish-plugin" version " 0.3.5"
45}
56
67architectury {
@@ -9,6 +10,7 @@ architectury {
910
1011subprojects {
1112 apply plugin : " dev.architectury.loom"
13+ apply plugin : " maven-publish"
1214
1315 loom {
1416 silentMojangMappingsLicense()
@@ -21,25 +23,31 @@ subprojects {
2123 // The following line declares the yarn mappings you may select this one as well.
2224 // mappings "net.fabricmc:yarn:1.18.2+build.4:v2"
2325 }
26+
27+ publishing {
28+ repositories {
29+ if (providers. environmentVariable(" SAPS_TOKEN" ). isPresent()) {
30+ maven {
31+ url " https://maven.saps.dev/${ providers.environmentVariable("SNAPSHOT").map { "snapshots" }.getOrElse("releases")} "
32+ credentials {
33+ username = " errormikey"
34+ password = " ${ providers.environmentVariable("SAPS_TOKEN").get()} "
35+ }
36+ }
37+ }
38+ }
39+ }
2440}
2541
2642allprojects {
2743 apply plugin : " java"
2844 apply plugin : " architectury-plugin"
2945 apply plugin : " maven-publish"
3046
31- ext. ENV = System . getenv()
32- ext. SNAPSHOT = ENV . SNAPSHOT != null && (ENV . SNAPSHOT == " true" || ENV . SNAPSHOT == true )
33- ext. MAVEN_URL = " https://maven.saps.dev/${ SNAPSHOT ? "snapshots" : "releases"} "
34- ext. MAVEN_VERSION = rootProject. version + (SNAPSHOT ? " -SNAPSHOT" : " " )
35-
3647 archivesBaseName = rootProject. archives_base_name
3748 version = " ${ rootProject.mod_version} +mc${ rootProject.minecraft_version} "
3849 group = rootProject. maven_group
3950
40- repositories {
41- }
42-
4351 tasks. withType(JavaCompile ) {
4452 options. encoding = " UTF-8"
4553 options. release = 17
@@ -50,4 +58,74 @@ allprojects {
5058 }
5159}
5260
53- task curseforgePublish
61+ publishMods {
62+ dryRun = providers. environmentVariable(" CURSE_TOKEN" ). getOrNull() == null
63+ changelog = file(" ./CHANGELOG.md" ). text
64+ version = " ${ mod_version} "
65+ type = STABLE
66+
67+ def fabricOptions = publishOptions {
68+ file = project. provider { project(" :fabric" ). tasks. remapJar }. flatMap { it. archiveFile }
69+ displayName = " ${ project.name} Fabric ${ mod_version} +mc${ minecraft_version} "
70+ modLoaders. add(" fabric" )
71+ }
72+
73+ def forgeOptions = publishOptions {
74+ file = project. provider { project(" :forge" ). tasks. remapJar }. flatMap { it. archiveFile }
75+ displayName = " ${ project.name} Forge ${ mod_version} +mc${ minecraft_version} "
76+ modLoaders. add(" neoforge" )
77+ }
78+
79+ def curseForgeOptions = curseforgeOptions {
80+ accessToken = providers. environmentVariable(" CURSE_TOKEN" )
81+ projectId = " ${ curseforge_id} "
82+ minecraftVersions. add(" ${ minecraft_version} " )
83+ }
84+
85+ def modrinthOptions = modrinthOptions {
86+ accessToken = providers. environmentVariable(" MODRINTH_TOKEN" )
87+ projectId = " ${ modrinth_id} "
88+ minecraftVersions. add(" ${ minecraft_version} " )
89+ }
90+
91+ curseforge(" curseforgeFabric" ) {
92+ from(curseForgeOptions, fabricOptions)
93+ requires {
94+ slug = " architectury-api"
95+ slug = " fabric-api"
96+ }
97+ }
98+
99+ curseforge(" curseforgeForge" ) {
100+ from(curseForgeOptions, forgeOptions)
101+ requires {
102+ slug = " architectury-api"
103+ }
104+ }
105+
106+ modrinth(" modrinthFabric" ) {
107+ from(modrinthOptions, fabricOptions)
108+ requires {
109+ slug = " architectury-api"
110+ slug = " fabric-api"
111+ }
112+ }
113+
114+ modrinth(" modrinthForge" ) {
115+ from(modrinthOptions, forgeOptions)
116+ requires {
117+ slug = " architectury-api"
118+ }
119+ }
120+
121+ github {
122+ file = project. provider { project(" :forge" ). tasks. remapJar }. flatMap { it. archiveFile }
123+ additionalFiles. from project. provider { project(" :fabric" ). tasks. remapJar }. flatMap { it. archiveFile }
124+
125+ repository = " ${ project.github_repo} "
126+ accessToken = providers. environmentVariable(" GITHUB_TOKEN" )
127+ commitish = providers. environmentVariable(" GITHUB_SHA" ). orElse(" dryRun" )
128+ tagName = providers. environmentVariable(" GITHUB_REF_NAME" ). orElse(" dryRun" )
129+ }
130+ }
131+
0 commit comments