@@ -10,11 +10,10 @@ plugins {
10
10
id " java"
11
11
id " maven-publish"
12
12
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"
15
13
id " fabric-loom" version " 1.9-SNAPSHOT" apply false
16
14
id " com.github.ben-manes.versions" version " 0.51.0"
17
15
id " xyz.wagyourtail.jvmdowngrader" version " 1.0.1"
16
+ id " me.modmuss50.mod-publish-plugin" version " 0.8.4"
18
17
}
19
18
20
19
def ENV = System . getenv()
@@ -186,63 +185,42 @@ processResources {
186
185
List<String > mcReleases = Arrays . stream(rootProject. publish_mc_versions. toString(). split(" ," ))
187
186
.map({ it -> it. trim() })
188
187
.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" )
209
188
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_TOKEN" ). getOrNull() == null
196
+
197
+ curseforge {
198
+ accessToken = providers. environmentVariable(" CURSEFORGE_TOKEN" )
199
+ projectId = " 391298"
200
+ type = BETA // alpha is hidden by default
201
+
202
+ javaVersions. add(JavaVersion . VERSION_1_8 )
203
+ javaVersions. add(JavaVersion . VERSION_1_9 )
204
+ javaVersions. add(JavaVersion . VERSION_1_10 )
205
+ IntStream . rangeClosed(11 , 22 ). forEach { n -> javaVersions. add(JavaVersion . valueOf(" VERSION_" + n)) }
206
+
207
+ minecraftVersions. addAll(mcReleases)
208
+ if (! rootProject. curseforge_mc_snapshot. isEmpty()) {
209
+ minecraftVersions. add(rootProject. curseforge_mc_snapshot)
216
210
}
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())
220
221
}
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
222
+ optional(" fabric-api" )
223
+ embeds(" viaversion" )
246
224
}
247
225
}
248
226
0 commit comments