Skip to content

Commit

Permalink
Sync with Framework
Browse files Browse the repository at this point in the history
  • Loading branch information
NotRyken committed Dec 9, 2024
1 parent 5aa9555 commit fc35fa8
Show file tree
Hide file tree
Showing 12 changed files with 161 additions and 146 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: Build
run: ./gradlew build neoforge:githubRelease neoforge:modrinth neoforge:curseforge fabric:githubRelease fabric:modrinth fabric:curseforge --stacktrace
# run: ./gradlew build neoforge:publishGithub fabric:publishGithub --stacktrace
run: ./gradlew build neoforge:publishGithub neoforge:publishModrinth neoforge:publishCurseforge fabric:publishGithub fabric:publishModrinth fabric:publishCurseforge --stacktrace
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## ClientSort

A standalone implementation of Siphalor's [Mouse Wheelie](https://github.com/Siphalor/mouse-wheelie) sorting algorithm.
A standalone implementation of Siphalor's [Mouse Wheelie](https://modrinth.com/mod/u5Ic2U1u) sorting algorithm.

[![Environment](https://img.shields.io/badge/Environment-Client-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AYht+malUqDnYQEclQneyiIo6likWwUNoKrTqYXPoHTRqSFBdHwbXg4M9i1cHFWVcHV0EQ/AFxdnBSdJESv0sKLWI8uLuH97735e47QGhUmGp2RQFVs4xUPCZmc6ti4BU9CKCP1jGJmXoivZiB5/i6h4/vdxGe5V335xhQ8iYDfCJxlOmGRbxBPLtp6Zz3iUOsJCnE58STBl2Q+JHrsstvnIsOCzwzZGRS88QhYrHYwXIHs5KhEs8QhxVVo3wh67LCeYuzWqmx1j35C4N5bSXNdZqjiGMJCSQhQkYNZVRgIUK7RoqJFJ3HPPwjjj9JLplcZTByLKAKFZLjB/+D3701C9NTblIwBnS/2PbHOBDYBZp12/4+tu3mCeB/Bq60tr/aAOY+Sa+3tfARMLgNXFy3NXkPuNwBhp90yZAcyU9TKBSA9zP6phwwdAv0r7l9a53j9AHIUK+Wb4CDQ2CiSNnrHu/u7ezbvzWt/v0ATphymIBZ6aQAAAAGYktHRAAKAAwAGd6C8noAAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfoBgcOHRYlcgoRAAABRklEQVR42u2YMUoDQRRAX0axUzCteIZ4hKn0FDmFhalSWKkgnkHt9AQWwhzBNr2tBGNno82ACwm6EZvxvwdTzP8s7P8zu8w8EJHIDABKKfvAFXAIbP/zmt+AR2CSc54NavFPwDDY4s+BUaorPwy4+3eBy1S3fVSOUoBv/jt2UmMv/A6cAHt1TGqsb36JzcYaMM05X3Tm56UUgLOe+SVa2wE3K2LXa+Sbb8BgRWxjjXzzDRj/EBv3fOarY6WUj8Z+glPgtlPcKbDVM998A/6cVM/GUXlN9WIQlYdUDwvzgMW/AMcp5zwDRsA9sAhQ+AK4Aw5yzs8aEZHY6AR1gjpBnaBOsLHrsE6wM9cJohPUCeoE0Qn+Hp0gOkGdoE5QRMKiE9QJ6gR1gjrBxq7DOsHOXCeITlAnqBNEJ/h7dILoBHWCOkERCcsncuextWq5TzoAAAAASUVORK5CYII=)]()
[![Latest Minecraft](https://img.shields.io/modrinth/game-versions/K0AkAin6?label=Latest%20Minecraft&color=%2300AF5C&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AYht+malUqDnYQEclQneyiIo6likWwUNoKrTqYXPoHTRqSFBdHwbXg4M9i1cHFWVcHV0EQ/AFxdnBSdJESv0sKLWI8uLuH97735e47QGhUmGp2RQFVs4x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XEDb4SlYC/AW0t3IQpiA17AAAAAElFTkSuQmCC)](https://modrinth.com/mod/K0AkAin6/versions)
Expand All @@ -31,10 +31,7 @@ NeoForge: [Cloth Config API](https://modrinth.com/mod/9s6osm5g)

### Credits

ClientSort uses Siphalor's sorting algorithm from Mouse Wheelie, under license.

Mouse Wheelie is available on [Modrinth](https://modrinth.com/mod/u5Ic2U1u) and
[GitHub](https://github.com/Siphalor/mouse-wheelie/releases).
ClientSort uses code from [Mouse Wheelie](https://github.com/Siphalor/mouse-wheelie), under license.

### Contact

Expand Down
207 changes: 104 additions & 103 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
plugins {
id("fabric-loom") version("${loom_version}") apply(false)
id("net.neoforged.moddev") version("${moddev_version}") apply(false)
id("com.modrinth.minotaur") version("${minotaur_version}")
id("net.darkhax.curseforgegradle") version("${curseforgegradle_version}")
id("com.github.breadmoirai.github-release") version("${githubrelease_version}")
id("me.modmuss50.mod-publish-plugin") version("${mpp_version}")
id("org.ajoberstar.grgit.service") version("${grgitservice_version}")
id("org.cadixdev.licenser") version("${licenser_version}")
}
Expand Down Expand Up @@ -40,126 +38,129 @@ subprojects {
}
} else {
// Publishing
apply(plugin: "com.modrinth.minotaur")
apply(plugin: "net.darkhax.curseforgegradle")
apply(plugin: "com.github.breadmoirai.github-release")
apply(plugin: "me.modmuss50.mod-publish-plugin")
apply(plugin: "org.ajoberstar.grgit.service")

afterEvaluate {
modrinth {
token = System.getenv().MODRINTH_TOKEN ? System.getenv().MODRINTH_TOKEN : "empty"
projectId = modrinth_id
versionNumber = mod_version
versionType = release_type
versionName = "v${mod_version}-${capsLoader(name)}"
changelog = versionChangelog()
uploadFile = name == "fabric" ? remapJar : jar
loaders = project.property("release_mod_loaders_${name}").split(",") as List
gameVersions = project.property("release_game_versions_${name}").split(",") as List

def deps = []
if (project.hasProperty("release_required_dep_ids_${name}_mr")) {
project.property("release_required_dep_ids_${name}_mr").split(",").each { String id ->
deps << new com.modrinth.minotaur.dependencies.ModDependency(id, "required")
}
publishMods {
file = project.name == "fabric" ? remapJar.archiveFile : jar.archiveFile
version = mod_version
type = me.modmuss50.mpp.ReleaseType.of(release_type)
displayName = "v${mod_version}-${capsLoader(project.name)}"
modLoaders.addAll(project.property("release_mod_loaders_${project.name}").split(","))
maxRetries = 5
github {
dryRun = providers.environmentVariable("GITHUB_TOKEN").getOrNull() == null
accessToken = providers.environmentVariable("GITHUB_TOKEN")
parent project(":").tasks.named("publishGithub")
additionalFiles.from(sourcesJar.archiveFile)
}
if (project.hasProperty("release_optional_dep_ids_${name}_mr")) {
project.property("release_optional_dep_ids_${name}_mr").split(",").each { String id ->
deps << new com.modrinth.minotaur.dependencies.ModDependency(id, "optional")
modrinth {
dryRun = providers.environmentVariable("MODRINTH_TOKEN").getOrNull() == null
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
projectId = modrinth_id
minecraftVersions.addAll(project.property("release_game_versions_${project.name}").split(","))
changelog = versionChangelog()
if (project.hasProperty("release_required_dep_ids_${project.name}_mr")) {
project.property("release_required_dep_ids_${project.name}_mr").split(",").each { String mrId ->
requires { id = mrId }
}
}
}
if (project.hasProperty("release_incompatible_dep_ids_${name}_mr")) {
project.property("release_incompatible_dep_ids_${name}_mr").split(",").each { String id ->
deps << new com.modrinth.minotaur.dependencies.ModDependency(id, "incompatible")
if (project.hasProperty("release_optional_dep_ids_${project.name}_mr")) {
project.property("release_optional_dep_ids_${project.name}_mr").split(",").each { String mrId ->
optional { id = mrId }
}
}
}
dependencies = deps
syncBodyFrom = rootProject.file("README.md").text
}
tasks.modrinth.onlyIf { System.getenv().MODRINTH_TOKEN }
tasks.modrinth.dependsOn(build, tasks.modrinthSyncBody)
tasks.modrinthSyncBody.onlyIf { System.getenv().MODRINTH_TOKEN }

task curseforge(type: net.darkhax.curseforgegradle.TaskPublishCurseForge) {
apiToken = System.getenv().CURSEFORGE_TOKEN ? System.getenv().CURSEFORGE_TOKEN : "empty"

disableVersionDetection()
String module = project.name

def file = upload(curseforge_id, module == "fabric" ? remapJar : jar)
file.displayName = "v${mod_version}-${capsLoader(module)}"
file.releaseType = release_type
file.changelog = versionChangelog()
file.changelogType = "markdown"
project.property("release_mod_loaders_${module}").split(",").each { String id ->
file.addModLoader(id)
}
project.property("release_game_versions_${module}").split(",").each { String id ->
file.addGameVersion(id, module)
}

if (project.hasProperty("release_required_dep_ids_${module}_cf")) {
project.property("release_required_dep_ids_${module}_cf").split(",").each { String id ->
file.addRequirement(id)
if (project.hasProperty("release_incompatible_dep_ids_${project.name}_mr")) {
project.property("release_incompatible_dep_ids_${project.name}_mr").split(",").each { String mrId ->
incompatible { id = mrId }
}
}
}
if (project.hasProperty("release_optional_dep_ids_${module}_cf")) {
project.property("release_optional_dep_ids_${module}_cf").split(",").each { String id ->
file.addOptional(id)
if (project.hasProperty("release_embedded_dep_ids_${project.name}_mr")) {
project.property("release_embedded_dep_ids_${project.name}_mr").split(",").each { String mrId ->
embeds { id = mrId }
}
}
// Sync Modrinth description with GitHub README
projectDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText
}
if (project.hasProperty("release_incompatible_dep_ids_${module}_cf")) {
project.property("release_incompatible_dep_ids_${module}_cf").split(",").each { String id ->
file.addIncompatibility(id)
curseforge {
dryRun = providers.environmentVariable("CURSEFORGE_TOKEN").getOrNull() == null
accessToken = providers.environmentVariable("CURSEFORGE_TOKEN")
projectId = curseforge_id
projectSlug = curseforge_slug
minecraftVersions.addAll(project.property("release_game_versions_${project.name}").split(","))
changelog = versionChangelog()
if (project.hasProperty("release_required_dep_ids_${project.name}_cf")) {
project.property("release_required_dep_ids_${project.name}_cf").split(",").each { String slug ->
requires(slug)
}
}
if (project.hasProperty("release_optional_dep_ids_${project.name}_cf")) {
project.property("release_optional_dep_ids_${project.name}_cf").split(",").each { String slug ->
optional(slug)
}
}
if (project.hasProperty("release_incompatible_dep_ids_${project.name}_cf")) {
project.property("release_incompatible_dep_ids_${project.name}_cf").split(",").each { String slug ->
incompatible(slug)
}
}
if (project.hasProperty("release_embedded_dep_ids_${project.name}_cf")) {
project.property("release_embedded_dep_ids_${project.name}_cf").split(",").each { String slug ->
embeds(slug)
}
}
}
}
tasks.curseforge.onlyIf { System.getenv().CURSEFORGE_TOKEN }
tasks.curseforge.dependsOn(build)

githubRelease {
token = System.getenv().GITHUB_TOKEN ? System.getenv().GITHUB_TOKEN : "empty"
owner = github_repo_owner
repo = github_repo
tagName = "v${mod_version}"
prerelease = release_type == "alpha" || release_type == "beta"
releaseName = "v${mod_version}"

String changelog = "\n\n## Changelog\n\n" + versionChangelog()
String versions = "## MC versions\n\n"
if (project.hasProperty("release_game_versions_fabric"))
versions = String.format("%s - Fabric: %s\n", versions,
project.property("release_game_versions_fabric"))
if (project.hasProperty("release_game_versions_neoforge"))
versions = String.format("%s - NeoForge: %s\n", versions,
project.property("release_game_versions_neoforge"))
body = versions + changelog

targetCommitish = grgitService.service.get().grgit.branch.current().name
overwrite = false
allowUploadToExisting = true
releaseAssets = List.of(name == "fabric" ? remapJar : jar, sourcesJar)
}
tasks.githubRelease.onlyIf { System.getenv().GITHUB_TOKEN }
tasks.githubRelease.dependsOn(build)
}
}
}

publishMods {
// This task is necessary to allow publishing files from multiple
// subprojects to a single GitHub release.
version = mod_version
type = me.modmuss50.mpp.ReleaseType.of(release_type)
github {
dryRun = providers.environmentVariable("GITHUB_TOKEN").getOrNull() == null
accessToken = providers.environmentVariable("GITHUB_TOKEN")
repository = github_repo
commitish = grgitService.service.get().grgit.branch.current().name
tagName = "v${mod_version}"
allowEmptyFiles = true
// Include compatible MC version lists in description
String versions = "## MC versions\n\n"
if (project.hasProperty("release_game_versions_fabric"))
versions = String.format("%s - Fabric: %s\n", versions,
project.property("release_game_versions_fabric"))
if (project.hasProperty("release_game_versions_neoforge"))
versions = String.format("%s - NeoForge: %s\n", versions,
project.property("release_game_versions_neoforge"))
changelog = versions + "\n\n## Changelog\n\n" + versionChangelog()
}
}

String versionChangelog() {
List<String> lines = rootProject.file("CHANGELOG.md").readLines()
StringBuilder builder = new StringBuilder()
for (int i = 4; i < lines.size(); i++) {
String line = lines.get(i)
if (line.isBlank()) {
// pass
} else if (line.startsWith("## ")) {
break
}
else {
if (!builder.isEmpty()) builder.append("\n")
builder.append(line)
if ("${mod_version}".startsWith(lines.get(2).substring(3))) {
for (int i = 4; i < lines.size(); i++) {
String line = lines.get(i)
if (line.isBlank()) {
// pass
} else if (line.startsWith("## ")) {
break
}
else {
if (!builder.isEmpty()) builder.append("\n")
builder.append(line)
}
}
} else {
throw new IllegalArgumentException(
String.format("Mod version '%s' does not start with changelog version '%s'",
mod_version, lines.get(2).substring(3)))
}
return builder.toString()
}
Expand Down
Loading

0 comments on commit fc35fa8

Please sign in to comment.