Skip to content

Commit

Permalink
use modmuss' mod publish plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
deirn committed Dec 10, 2023
1 parent ee4036c commit 36315b8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- id: vars
run: |
echo ::set-output name=VERSION::git-${GITHUB_SHA:0:7}
echo "VERSION=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
steps:
- id: vars
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/*/}
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
Expand All @@ -19,10 +19,11 @@ jobs:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
restore-keys: ${{ runner.os }}-gradle
- run: ./gradlew build curseforge
- run: ./gradlew build publishMods
env:
MOD_VERSION: ${{ steps.vars.outputs.VERSION }}
CURSEFORGE_API: ${{ secrets.CURSEFORGE_API }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
- uses: actions/upload-artifact@v2
with:
name: build ${{ steps.vars.outputs.VERSION }}
Expand Down
72 changes: 31 additions & 41 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseProject
import com.matthewprenger.cursegradle.CurseRelation
import me.modmuss50.mpp.ReleaseType

plugins {
id("fabric-loom").version("1.4.+")
id("com.matthewprenger.cursegradle").version("1.4.0")
id("fabric-loom") version "1.4.+"
id("me.modmuss50.mod-publish-plugin") version "0.4.5"
}

val env: Map<String, String> = System.getenv()
Expand Down Expand Up @@ -67,41 +65,33 @@ dependencies {
}
}

curseforge {
env["CURSEFORGE_API"]?.let { CURSEFORGE_API ->
apiKey = CURSEFORGE_API
project(closureOf<CurseProject> {
id = prop["cf.projectId"]
releaseType = prop["cf.releaseType"]

changelogType = "markdown"
changelog = "https://github.com/badasintended/cpas/releases/tag/${project.version}"

mainArtifact(tasks["remapJar"], closureOf<CurseArtifact> {
displayName = "[${prop["minecraft"]}] v${project.version}"
})

addGameVersion("Fabric")
prop["cf.gameVersion"].split(", ").forEach {
addGameVersion(it)
}

relations(closureOf<CurseRelation> {
prop.ifPresent("cf.require") { require ->
require.split(", ").forEach {
requiredDependency(it)
}
}
prop.ifPresent("cf.optional") { optional ->
optional.split(", ").forEach {
optionalDependency(it)
}
}
})

afterEvaluate {
uploadTask.dependsOn("build")
}
})
publishMods {
file.set(tasks.remapJar.get().archiveFile)
changelog.set("https://github.com/badasintended/cpas/releases/tag/${project.version}")
type.set(ReleaseType.of(prop["releaseType"]))
modLoaders.add("fabric")

env["CURSEFORGE_API"]?.let { apiKey ->
curseforge {
accessToken.set(apiKey)
projectId.set(prop["cf.projectId"])

minecraftVersions.addAll(prop["cf.gameVersion"].split(", "))

prop.ifPresent("cf.require") { requires(*it.split(", ").toTypedArray()) }
prop.ifPresent("cf.optional") { optional(*it.split(", ").toTypedArray()) }
}
}

env["MODRINTH_TOKEN"]?.let { token ->
modrinth {
accessToken.set(token)
projectId.set(prop["cf.projectId"])

minecraftVersions.addAll(prop["mr.gameVersion"].split(", "))

prop.ifPresent("mr.require") { requires(*it.split(", ").toTypedArray()) }
prop.ifPresent("mr.optional") { optional(*it.split(", ").toTypedArray()) }
}
}
}
12 changes: 10 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ fabric = 0.58.0+1.19
trinkets = 3.4.0
rei = 9.1.668

# Publishing
releaseType = stable

# CurseForge
cf.projectId = 422447
cf.releaseType = release
cf.gameVersion = 1.19
cf.gameVersion = 1.19, 1.19.1, 1.19.2
cf.require = fabric-api
cf.optional = roughly-enough-items, trinkets-fabric

# Modrinth
mr.projectId = lJcgfZtA
mr.gameVersion = 1.19, 1.19.1, 1.19.2
mr.require = fabric-api
mr.optional = rei, trinkets

0 comments on commit 36315b8

Please sign in to comment.