Skip to content

Commit

Permalink
Add modrinth upload task
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Jan 29, 2023
1 parent 4e1333e commit 9cdd991
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ changelog.html
*.launch
/**/build/
/**/logs
Changelog/changelog.md
10 changes: 9 additions & 1 deletion .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ pipeline {
}

environment {
ORG_GRADLE_PROJECT_curseforge_apikey = credentials('jei-curseforge-key')
ORG_GRADLE_PROJECT_curseforge_apikey = credentials("jei-curseforge-key")
ORG_GRADLE_PROJECT_modrinthToken = credentials("modrinth-auth-token")
ORG_GRADLE_PROJECT_BUILD_NUMBER = "${env.BUILD_NUMBER}"
}
stages {
Expand Down Expand Up @@ -61,5 +62,12 @@ pipeline {
sh "./gradlew :Forge:publishCurseForge --no-daemon"
}
}

stage('Publish Modrinth') {
steps {
sh "./gradlew :Fabric:modrinth --no-daemon"
sh "./gradlew :Forge:modrinth --no-daemon"
}
}
}
}
20 changes: 16 additions & 4 deletions Changelog/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask

plugins {
id("se.bjurr.gitchangelog.git-changelog-gradle-plugin") version("1.71.4")
id("se.bjurr.gitchangelog.git-changelog-gradle-plugin") version("1.77.2")
}

// gradle.properties
val specificationVersion: String by extra
val changelogUntaggedName = "Current release $specificationVersion"
val firstChangelogCommit = "e72e49fa7a072755e7f96cad65388205f6a010dc"
val lastChangelogCommit = "HEAD"

tasks.register<GitChangelogTask>("makeChangelog") {
fromRepo = projectDir.absolutePath.toString()
file = file("changelog.html")
untaggedName = "Current release $specificationVersion"
fromCommit = "e72e49fa7a072755e7f96cad65388205f6a010dc"
toRef = "HEAD"
untaggedName = changelogUntaggedName
fromCommit = firstChangelogCommit
toRef = lastChangelogCommit
templateContent = file("changelog.mustache").readText()
}

tasks.register<GitChangelogTask>("makeMarkdownChangelog") {
fromRepo = projectDir.absolutePath.toString()
file = file("changelog.md")
untaggedName = changelogUntaggedName
fromCommit = firstChangelogCommit
toRef = lastChangelogCommit
templateContent = file("changelog-markdown.mustache").readText()
}
6 changes: 6 additions & 0 deletions Changelog/changelog-markdown.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{#tags}}
### {{name}}
{{#commits}}
* [{{{messageTitle}}}](https://github.com/mezz/JustEnoughItems/commit/{{hashFull}}) - {{{authorName}}}
{{/commits}}
{{/tags}}
14 changes: 14 additions & 0 deletions Fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {
`maven-publish`
id("fabric-loom") version("0.12-SNAPSHOT")
id("net.darkhax.curseforgegradle") version("1.0.8")
id("com.modrinth.minotaur") version("2.+")
}

repositories {
Expand All @@ -32,6 +33,9 @@ val modJavaVersion: String by extra
val parchmentVersionFabric: String by extra
val parchmentMinecraftVersion: String by extra

// set by ORG_GRADLE_PROJECT_modrinthToken in Jenkinsfile
val modrinthToken: String? by project

val baseArchivesName = "${modId}-${minecraftVersion}-fabric"
base {
archivesName.set(baseArchivesName)
Expand Down Expand Up @@ -176,6 +180,16 @@ tasks.register<TaskPublishCurseForge>("publishCurseForge") {
}
}

modrinth {
token.set(modrinthToken)
projectId.set("jei")
versionType.set("beta")
uploadFile.set(tasks.remapJar.get())
changelog.set(provider { file("../Changelog/changelog.md").readText() })
}
tasks.modrinth.get().dependsOn(tasks.remapJar)
tasks.modrinth.get().dependsOn(":Changelog:makeMarkdownChangelog")

tasks.named<Test>("test") {
useJUnitPlatform()
include("mezz/jei/test/**")
Expand Down
14 changes: 14 additions & 0 deletions Forge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ plugins {
id("net.minecraftforge.gradle") version("5.1.+")
id("org.parchmentmc.librarian.forgegradle") version("1.+")
id("net.darkhax.curseforgegradle") version("1.0.8")
id("com.modrinth.minotaur") version("2.+")
}

// gradle.properties
Expand All @@ -22,6 +23,9 @@ val modId: String by extra
val modJavaVersion: String by extra
val parchmentVersionForge: String by extra

// set by ORG_GRADLE_PROJECT_modrinthToken in Jenkinsfile
val modrinthToken: String? by project

val baseArchivesName = "${modId}-${minecraftVersion}-forge"
base {
archivesName.set(baseArchivesName)
Expand Down Expand Up @@ -163,6 +167,16 @@ tasks.register<TaskPublishCurseForge>("publishCurseForge") {
}
}

modrinth {
token.set(modrinthToken)
projectId.set("jei")
versionType.set("beta")
uploadFile.set(tasks.jar.get())
changelog.set(provider { file("../Changelog/changelog.md").readText() })
}
tasks.modrinth.get().dependsOn(tasks.jar)
tasks.modrinth.get().dependsOn(":Changelog:makeMarkdownChangelog")

tasks.named<Test>("test") {
useJUnitPlatform()
include("mezz/jei/test/**")
Expand Down

0 comments on commit 9cdd991

Please sign in to comment.