Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: Artifacts
path: build/libs/
path: versions/*/build/libs/

client-game-test:
name: Client Game Test
Expand All @@ -66,10 +66,10 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@017a9effdb900e5b5b2fddfb590a105619dca3c3 # v4.4.2
- name: Run client game tests
run: ./gradlew runProductionClientGameTest
run: ./gradlew :1.21.8:runProductionClientGameTest
- name: Upload screenshots
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: Client Game Test Screenshots
path: build/run/clientGameTest/screenshots/
path: versions/*/build/run/clientGameTest/screenshots/
22 changes: 19 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,30 @@ jobs:
run: ./gradlew build
env:
MOD_VERSION: ${{ steps.version.outputs.mod_version }}
- name: Publish
- name: Publish to Modrinth and CurseForge
run: ./gradlew publishMods
env:
MOD_VERSION: ${{ steps.version.outputs.mod_version }}
TAG_NAME: ${{ github.ref_name }}
CHANGELOG: ${{ steps.tag_message.outputs.message }}
MODRINTH_ID: ${{ secrets.MODRINTH_ID }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_ID: ${{ secrets.CURSEFORGE_ID }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.ref_name }}
RELEASE_NOTES: ${{ steps.tag_message.outputs.message }}
MOD_VERSION: ${{ steps.version.outputs.mod_version }}
run: |
shopt -s nullglob
assets=(versions/*/build/libs/connectedtank-"${MOD_VERSION}"+mc*.jar)
if [ ${#assets[@]} -eq 0 ]; then
echo "::error::No release assets found matching pattern"
exit 1
fi
echo "Found ${#assets[@]} release asset(s): ${assets[*]}"
gh release create "$TAG_NAME" \
--title "$TAG_NAME" \
--notes "$RELEASE_NOTES" \
"${assets[@]}"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,7 @@ hs_err_*.log
replay_*.log
*.hprof
*.jfr

# git-hooks.nix

.pre-commit-config.yaml
4 changes: 2 additions & 2 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

## 動作要件

- Minecraft 1.21.8
- Minecraft 1.21.8 / 1.21.11
- Fabric Loader >= 0.17.2
- Fabric API
- Fabric Language Kotlin
Expand Down Expand Up @@ -84,7 +84,7 @@
./gradlew build
```

ビルド成果物は `build/libs/` に出力されます。
ビルド成果物は `versions/*/build/libs/` に出力されます。

## ライセンス

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Base capacity is 32 buckets by default (configurable). Each tank's capacity = ba

## Requirements

- Minecraft 1.21.8
- Minecraft 1.21.8 / 1.21.11
- Fabric Loader >= 0.17.2
- Fabric API
- Fabric Language Kotlin
Expand Down Expand Up @@ -86,7 +86,7 @@ Base capacity is 32 buckets by default (configurable). Each tank's capacity = ba
./gradlew build
```

The built jar will be in `build/libs/`.
The built jars will be in `versions/*/build/libs/`.

## License

Expand Down
90 changes: 50 additions & 40 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import java.util.concurrent.TimeUnit
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id("dev.kikugie.stonecutter")
alias(libs.plugins.fabric.loom)
id("maven-publish")
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.spotless)
alias(libs.plugins.mod.publish.plugin)
}

version = providers.environmentVariable("MOD_VERSION").orElse("dev").get()
val mcVersion = stonecutter.current.version

version = providers.environmentVariable("MOD_VERSION").orElse("dev").get() + "+mc$mcVersion"
group = project.property("maven_group") as String

base {
Expand Down Expand Up @@ -109,34 +111,64 @@ loom {
}

dependencies {
// To change the versions see the gradle/libs.versions.toml file
minecraft(libs.minecraft)
mappings(variantOf(libs.yarn.mappings) { classifier("v2") })
val yarnMappings = when (mcVersion) {
"1.21.8" -> "1.21.8+build.1"
"1.21.11" -> "1.21.11+build.5"
else -> error("Unsupported MC version: $mcVersion")
}
val fabricApiVersion = when (mcVersion) {
"1.21.8" -> "0.132.0+1.21.8"
"1.21.11" -> "0.141.3+1.21.11"
else -> error("Unsupported MC version: $mcVersion")
}
val yaclVersion = when (mcVersion) {
"1.21.8" -> "3.7.1+1.21.6-fabric"
"1.21.11" -> "3.8.2+1.21.11-fabric"
else -> error("Unsupported MC version: $mcVersion")
}
val modmenuVersion = when (mcVersion) {
"1.21.8" -> "15.0.1"
"1.21.11" -> "17.0.0"
else -> error("Unsupported MC version: $mcVersion")
}
val reiVersion = when (mcVersion) {
"1.21.8" -> "20.0.811"
"1.21.11" -> "21.11.814"
else -> error("Unsupported MC version: $mcVersion")
}
val jadeVersion = when (mcVersion) {
"1.21.8" -> "19.3.2+fabric"
"1.21.11" -> "21.1.6+fabric"
else -> error("Unsupported MC version: $mcVersion")
}

minecraft("com.mojang:minecraft:$mcVersion")
mappings("net.fabricmc:yarn:$yarnMappings:v2")
modImplementation(libs.fabric.loader)

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation(libs.fabric.api)
modImplementation("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
modImplementation(libs.fabric.language.kotlin)

"productionRuntimeMods"(libs.fabric.api)
"productionRuntimeMods"("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
"productionRuntimeMods"(libs.fabric.language.kotlin)

modCompileOnly(libs.yacl)
modRuntimeOnly(libs.yacl)
modCompileOnly(libs.modmenu)
modRuntimeOnly(libs.modmenu)
modCompileOnly("dev.isxander:yet-another-config-lib:$yaclVersion")
modRuntimeOnly("dev.isxander:yet-another-config-lib:$yaclVersion")
modCompileOnly("com.terraformersmc:modmenu:$modmenuVersion")
modRuntimeOnly("com.terraformersmc:modmenu:$modmenuVersion")

modRuntimeOnly(libs.rei)
modCompileOnly(libs.jade)
modRuntimeOnly(libs.jade)
modRuntimeOnly("me.shedaniel:RoughlyEnoughItems-fabric:$reiVersion")
modCompileOnly("maven.modrinth:jade:$jadeVersion")
modRuntimeOnly("maven.modrinth:jade:$jadeVersion")
}

tasks {
processResources {
inputs.property("version", project.version)
inputs.property("minecraft_version", mcVersion)

filesMatching("fabric.mod.json") {
expand("version" to inputs.properties["version"])
expand(mapOf("version" to inputs.properties["version"], "minecraft_version" to inputs.properties["minecraft_version"]))
}
}
jar {
Expand All @@ -149,10 +181,6 @@ tasks {
withType<JavaCompile>().configureEach {
options.release.set(21)
}
@Suppress("UnstableApiUsage")
named<UpdateDaemonJvm>("updateDaemonJvm") {
languageVersion = JavaLanguageVersion.of(21)
}
val clientGametestJar = register<Jar>("clientGametestJar") {
from(clientGametestSourceSet.output)
archiveClassifier.set("client-gametest")
Expand Down Expand Up @@ -193,18 +221,6 @@ java {
targetCompatibility = JavaVersion.VERSION_21
}

spotless {
kotlin {
ktlint()
}
kotlinGradle {
ktlint()
}
java {
palantirJavaFormat()
}
}

publishMods {
file.set(tasks.remapJar.flatMap { it.archiveFile })
additionalFiles.from(tasks.remapSourcesJar.flatMap { it.archiveFile })
Expand All @@ -215,23 +231,17 @@ publishMods {
modrinth {
projectId.set(providers.environmentVariable("MODRINTH_ID"))
accessToken.set(providers.environmentVariable("MODRINTH_TOKEN"))
minecraftVersions.add(libs.versions.minecraft)
minecraftVersions.add(mcVersion)
requires("fabric-api")
requires("fabric-language-kotlin")
}
curseforge {
projectId.set(providers.environmentVariable("CURSEFORGE_ID"))
accessToken.set(providers.environmentVariable("CURSEFORGE_TOKEN"))
minecraftVersions.add(libs.versions.minecraft)
minecraftVersions.add(mcVersion)
requires("fabric-api")
requires("fabric-language-kotlin")
}
github {
repository.set("turtton/ConnectedTank")
accessToken.set(providers.environmentVariable("GITHUB_TOKEN"))
commitish.set("main")
tagName.set(providers.environmentVariable("TAG_NAME").orElse("v${project.version}"))
}
}

// configure the maven publication
Expand Down
60 changes: 60 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading