@@ -10,11 +10,10 @@ plugins {
1010 id " java"
1111 id " maven-publish"
1212 id " org.ajoberstar.grgit" version " 5.3.0"
13- id " com.matthewprenger.cursegradle" version " 1.4.0" // This repository is archived on GH
14- id " com.modrinth.minotaur" version " 2.8.7"
1513 id " fabric-loom" version " 1.9-SNAPSHOT" apply false
1614 id " com.github.ben-manes.versions" version " 0.51.0"
1715 id " xyz.wagyourtail.jvmdowngrader" version " 1.0.1"
16+ id " me.modmuss50.mod-publish-plugin" version " 0.4.5"
1817}
1918
2019def ENV = System . getenv()
@@ -186,63 +185,48 @@ processResources {
186185List<String > mcReleases = Arrays . stream(rootProject. publish_mc_versions. toString(). split(" ," ))
187186 .map({ it -> it. trim() })
188187 .collect(Collectors . toList())
189- List<String > javaVersions = IntStream . rangeClosed(8 , 22 )
190- .mapToObj { n -> (String ) " Java $n " }
191- .collect(Collectors . toList())
192- String changelogMsg = " A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits"
193- String versionNameMsg = " [${ getBranch()} ] ViaFabric " + rootProject. version
194-
195- curseforge {
196- if (ENV . CURSEFORGE_API_KEY ) {
197- apiKey = ENV . CURSEFORGE_API_KEY
198- }
199-
200- project {
201- id = " 391298"
202- changelog = changelogMsg
203- releaseType = " beta" // alpha is hidden by default
204-
205- mcReleases. forEach { ver -> addGameVersion(ver) }
206- if (! rootProject. curseforge_mc_snapshot. isEmpty()) addGameVersion(rootProject. curseforge_mc_snapshot)
207- javaVersions. forEach(v -> addGameVersion(v))
208- addGameVersion(" Fabric" )
209188
210- mainArtifact(remapJar) {
211- displayName = versionNameMsg
212- relations {
213- optionalDependency(" fabric-api" )
214- embeddedLibrary(" cotton-client-commands" )
215- }
189+ publishMods {
190+ file = remapJar. archiveFile
191+ changelog = " A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits"
192+ version = rootProject. version
193+ displayName = " [${ getBranch()} ] ViaFabric " + rootProject. version
194+ modLoaders. add(" fabric" )
195+ dryRun = providers. environmentVariable(" CURSEFORGE_API_KEY" ). getOrNull() == null
196+
197+ curseforge {
198+ accessToken = providers. environmentVariable(" CURSEFORGE_API_KEY" )
199+ projectId = " 391298"
200+ type = BETA // alpha is hidden by default
201+
202+ minecraftVersions. addAll(IntStream . rangeClosed(8 , 22 )
203+ .mapToObj { n -> (String ) " Java $n " }
204+ .collect(Collectors . toList()))
205+ minecraftVersions. add(" Fabric" )
206+
207+ minecraftVersions. addAll(mcReleases)
208+ if (! rootProject. curseforge_mc_snapshot. isEmpty()) {
209+ minecraftVersions. add(rootProject. curseforge_mc_snapshot)
216210 }
217-
218- afterEvaluate {
219- uploadTask. dependsOn(" remapJar" )
211+ optional(" fabric-api" )
212+ embeds(" cotton-client-commands" )
213+ }
214+ modrinth {
215+ accessToken = providers. environmentVariable(" MODRINTH_TOKEN" )
216+ projectId = " YlKdE5VK"
217+ type = ALPHA
218+ minecraftVersions. addAll(mcReleases)
219+ if (! rootProject. modrinth_mc_snapshot. isEmpty()) {
220+ minecraftVersions. add(rootProject. modrinth_mc_snapshot. toString())
221+ }
222+ optional {
223+ id = " P7dR8mSH"
224+ slug = " fabric-api"
225+ }
226+ embeds {
227+ id = " P1OZGk5p"
228+ slug = " viaversion"
220229 }
221- }
222-
223- options {
224- forgeGradleIntegration = false
225- }
226- }
227-
228- modrinth {
229- token. set(ENV . MODRINTH_TOKEN )
230- projectId. set(" YlKdE5VK" )
231- versionType. set(" alpha" )
232- versionNumber. set(rootProject. version)
233- versionName. set(versionNameMsg)
234- changelog. set(changelogMsg)
235-
236- uploadFile. set(remapJar)
237-
238- List<String > mcs = new ArrayList<> (mcReleases)
239- if (! rootProject. modrinth_mc_snapshot. isEmpty()) mcs. add(rootProject. modrinth_mc_snapshot. toString())
240- gameVersions. set(mcs)
241- loaders. set([" fabric" ])
242-
243- dependencies {
244- optional. project " P7dR8mSH" // fabric api
245- embedded. project " P1OZGk5p" // viaversion
246230 }
247231}
248232
0 commit comments