diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 473e8319..6a795f2d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,6 +20,6 @@ jobs: check-latest: true - name: Build and Publish env: - CURSEFORGE_API_KEY: ${{ secrets.CREEPER_CF }} + CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - run: ./gradlew curseforge modrinth + run: ./gradlew publishMods diff --git a/build.gradle b/build.gradle index 580d3ba1..4d8a8ddb 100644 --- a/build.gradle +++ b/build.gradle @@ -10,11 +10,10 @@ plugins { id "java" id "maven-publish" id "org.ajoberstar.grgit" version "5.3.0" - id "com.matthewprenger.cursegradle" version "1.4.0" // This repository is archived on GH - id "com.modrinth.minotaur" version "2.8.7" id "fabric-loom" version "1.9-SNAPSHOT" apply false id "com.github.ben-manes.versions" version "0.51.0" id "xyz.wagyourtail.jvmdowngrader" version "1.0.1" + id "me.modmuss50.mod-publish-plugin" version "0.4.5" } def ENV = System.getenv() @@ -186,63 +185,42 @@ processResources { List mcReleases = Arrays.stream(rootProject.publish_mc_versions.toString().split(",")) .map({ it -> it.trim() }) .collect(Collectors.toList()) -List javaVersions = IntStream.rangeClosed(8, 22) - .mapToObj { n -> (String) "Java $n" } - .collect(Collectors.toList()) -String changelogMsg = "A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits" -String versionNameMsg = "[${getBranch()}] ViaFabric " + rootProject.version - -curseforge { - if (ENV.CURSEFORGE_API_KEY) { - apiKey = ENV.CURSEFORGE_API_KEY - } - - project { - id = "391298" - changelog = changelogMsg - releaseType = "beta" // alpha is hidden by default - - mcReleases.forEach { ver -> addGameVersion(ver) } - if (!rootProject.curseforge_mc_snapshot.isEmpty()) addGameVersion(rootProject.curseforge_mc_snapshot) - javaVersions.forEach(v -> addGameVersion(v)) - addGameVersion("Fabric") - mainArtifact(remapJar) { - displayName = versionNameMsg - relations { - optionalDependency("fabric-api") - embeddedLibrary("cotton-client-commands") - } +publishMods { + file = remapJar.archiveFile + changelog = "A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits" + version = rootProject.version + displayName = "[${getBranch()}] ViaFabric " + rootProject.version + modLoaders.add("fabric") + dryRun = providers.environmentVariable("CURSEFORGE_API_KEY").getOrNull() == null + + curseforge { + accessToken = providers.environmentVariable("CURSEFORGE_API_KEY") + projectId = "391298" + type = BETA // alpha is hidden by default + + minecraftVersions.addAll(IntStream.rangeClosed(8, 22) + .mapToObj { n -> (String) "Java $n" } + .collect(Collectors.toList())) + minecraftVersions.add("Fabric") + + minecraftVersions.addAll(mcReleases) + if (!rootProject.curseforge_mc_snapshot.isEmpty()) { + minecraftVersions.add(rootProject.curseforge_mc_snapshot) } - - afterEvaluate { - uploadTask.dependsOn("remapJar") + optional("fabric-api") + embeds("cotton-client-commands") + } + modrinth { + accessToken = providers.environmentVariable("MODRINTH_TOKEN") + projectId = "YlKdE5VK" + type = ALPHA + minecraftVersions.addAll(mcReleases) + if (!rootProject.modrinth_mc_snapshot.isEmpty()) { + minecraftVersions.add(rootProject.modrinth_mc_snapshot.toString()) } - } - - options { - forgeGradleIntegration = false - } -} - -modrinth { - token.set(ENV.MODRINTH_TOKEN) - projectId.set("YlKdE5VK") - versionType.set("alpha") - versionNumber.set(rootProject.version) - versionName.set(versionNameMsg) - changelog.set(changelogMsg) - - uploadFile.set(remapJar) - - List mcs = new ArrayList<>(mcReleases) - if (!rootProject.modrinth_mc_snapshot.isEmpty()) mcs.add(rootProject.modrinth_mc_snapshot.toString()) - gameVersions.set(mcs) - loaders.set(["fabric"]) - - dependencies { - optional.project "P7dR8mSH" // fabric api - embedded.project "P1OZGk5p" // viaversion + optional("fabric-api") + embeds("viaversion") } }