Skip to content

Commit

Permalink
Add automatic modrinth&curse publishing, mr is disabled until they fi…
Browse files Browse the repository at this point in the history
…x the PAT webpage
  • Loading branch information
eigenraven committed Apr 14, 2024
1 parent c7bc58f commit 8a9f6f4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
30 changes: 28 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
import com.gtnewhorizons.retrofuturagradle.util.Distribution
import com.modrinth.minotaur.ModrinthExtension
import org.apache.tools.ant.filters.ReplaceTokens
import java.time.OffsetDateTime
import java.time.ZoneOffset
Expand Down Expand Up @@ -158,7 +159,13 @@ val mmcInstanceFilesZip = tasks.register<Zip>("mmcInstanceFiles") {
into("libraries/")
}
exclude("META-INF", "META-INF/**")
filesMatching(listOf("mmc-pack.json", "patches/me.eigenraven.lwjgl3ify.forgepatches.json", "patches/me.eigenraven.lwjgl3ify.launchargs.json")) {
filesMatching(
listOf(
"mmc-pack.json",
"patches/me.eigenraven.lwjgl3ify.forgepatches.json",
"patches/me.eigenraven.lwjgl3ify.launchargs.json"
)
) {
expand(
mapOf(
"version" to project.version,
Expand Down Expand Up @@ -186,7 +193,8 @@ val versionJsonFile = tasks.register("versionJson") {
ReplaceTokens::class, "tokens" to mapOf(
"version" to project.version,
"jvmArgs" to extraJavaArgs.map { '"' + it + '"' }.joinToString(", "),
"time" to DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX").format(OffsetDateTime.now(ZoneOffset.UTC))
"time" to DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX")
.format(OffsetDateTime.now(ZoneOffset.UTC))
)
)
}
Expand Down Expand Up @@ -343,3 +351,21 @@ tasks.shadowJar {

apply(from = "repositories.gradle")
apply(from = "dependencies.gradle")

pluginManager.withPlugin("com.modrinth.minotaur") {
val modrinth = project.extensions.getByType<ModrinthExtension>()
modrinth.additionalFiles.add(forgePatchesJar)
tasks.named("modrinth") {
dependsOn(forgePatchesJar)
}
}

tasks.publishCurseforge {
dependsOn(forgePatchesJar)
val mainArtifact = this.uploadArtifacts[0]
mainArtifact.withAdditionalFile(forgePatchesJar.get().archiveFile.get().asFile)
mainArtifact.additionalArtifacts.forEach { additionalArtifact ->
additionalArtifact.changelogType = mainArtifact.changelogType
additionalArtifact.changelog = mainArtifact.changelog
}
}
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ usesMavenPublishing = true
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
#modrinthProjectId = eC4lt4Oy
modrinthProjectId =

# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
Expand All @@ -150,7 +151,7 @@ modrinthRelations =
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
curseForgeProjectId = 998880

# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
Expand Down

0 comments on commit 8a9f6f4

Please sign in to comment.