forked from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
286 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,64 @@ | ||
name: build | ||
on: [ pull_request, push ] | ||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
type: | ||
type: choice | ||
description: Type of build | ||
required: true | ||
options: | ||
- normal | ||
- snapshot | ||
- release | ||
default: normal | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
java: [ 21 ] | ||
runs-on: ubuntu-latest | ||
env: | ||
PUBLISH_SUFFIX: snapshots | ||
MAVEN_USER: ${{ secrets.MAVEN_USER }} | ||
MAVEN_PASS: ${{ secrets.MAVEN_PASS }} | ||
steps: | ||
- name: checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: setup jdk ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
- name: Setup Java ${{ matrix.java }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: make gradle wrapper executable | ||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Make Gradle Wrapper Executable | ||
run: chmod +x ./gradlew | ||
|
||
- name: build | ||
run: ./gradlew buildOrPublish | ||
- name: Run Tests | ||
run: ./gradlew runGametest | ||
|
||
- name: Build | ||
if: ${{ github.event.inputs.type == 'normal' }} | ||
run: ./gradlew build | ||
|
||
- name: Publish Snapshot | ||
if: ${{ github.event.inputs.type == 'snapshot' }} | ||
run: >- | ||
./gradlew publishAllPublicationsToDevOsSnapshotsRepository | ||
-PdevOsSnapshotsUsername="${{ secrets.MAVEN_USER }}" | ||
-PdevOsSnapshotsPassword="${{ secrets.MAVEN_PASS }}" | ||
- name: Publish Release | ||
if: ${{ github.event.inputs.type == 'release' }} | ||
run: >- | ||
./gradlew publishAllPublicationsToDevOsReleasesRepository | ||
-PdevOsReleasesUsername="${{ secrets.MAVEN_USER }}" | ||
-PdevOsReleasesPassword="${{ secrets.MAVEN_PASS }}" | ||
- name: capture build artifacts | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Artifacts | ||
path: build/libs/ |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// versions | ||
val minecraftVersion = "1.21.1" | ||
val minecraftDep = "=1.21.1" | ||
// https://parchmentmc.org/docs/getting-started | ||
val parchmentVersion = "2024.11.17" | ||
// https://fabricmc.net/develop | ||
val loaderVersion = "0.16.9" | ||
val fapiVersion = "0.114.0+1.21.1" | ||
|
||
// dev env mods | ||
// https://modrinth.com/mod/sodium/versions?l=fabric | ||
val sodiumVersion = "mc1.21.1-0.6.5-fabric" | ||
// https://modrinth.com/mod/jade/versions?l=fabric | ||
val jadeVersion = "15.9.2+fabric" | ||
// https://modrinth.com/mod/modmenu/versions | ||
val modmenuVersion = "11.0.3" | ||
// https://modrinth.com/mod/suggestion-tweaker/versions?l=fabric | ||
val suggestionTweakerVersion = "1.20.6-1.5.2+fabric" | ||
// https://modrinth.com/mod/cloth-config/versions?l=fabric | ||
val clothConfigVersion = "15.0.140+fabric" | ||
|
||
// buildscript | ||
plugins { | ||
id("fabric-loom") version "1.9.+" | ||
id("maven-publish") | ||
} | ||
|
||
base.archivesName = "modid" | ||
group = "io.github.tropheusj" | ||
|
||
val buildNum = providers.systemProperty("GITHUB_RUN_NUMBER") | ||
.filter(String::isNotEmpty) | ||
.map { "build.$it" } | ||
.orElse("local") | ||
.get() | ||
|
||
version = "0.1.0+$buildNum-mc$minecraftVersion" | ||
|
||
repositories { | ||
maven("https://maven.parchmentmc.org") | ||
maven("https://api.modrinth.com/maven") | ||
} | ||
|
||
dependencies { | ||
// dev environment | ||
minecraft("com.mojang:minecraft:$minecraftVersion") | ||
mappings(loom.layered { | ||
officialMojangMappings { nameSyntheticMembers = false } | ||
parchment("org.parchmentmc.data:parchment-$minecraftVersion:$parchmentVersion@zip") | ||
}) | ||
modImplementation("net.fabricmc:fabric-loader:$loaderVersion") | ||
|
||
// dependencies | ||
modImplementation("net.fabricmc.fabric-api:fabric-api:$fapiVersion") | ||
|
||
// dev env | ||
modLocalRuntime("maven.modrinth:sodium:$sodiumVersion") | ||
modLocalRuntime("maven.modrinth:jade:$jadeVersion") | ||
modLocalRuntime("maven.modrinth:modmenu:$modmenuVersion") | ||
modLocalRuntime("maven.modrinth:suggestion-tweaker:$suggestionTweakerVersion") | ||
modLocalRuntime("maven.modrinth:cloth-config:$clothConfigVersion") | ||
} | ||
|
||
tasks.withType(ProcessResources::class) { | ||
val properties: Map<String, Any> = mapOf( | ||
"version" to version, | ||
"loader_version" to loaderVersion, | ||
"fapi_version" to fapiVersion, | ||
"minecraft_dependency" to minecraftDep | ||
) | ||
|
||
inputs.properties(properties) | ||
|
||
filesMatching("fabric.mod.json") { | ||
expand(properties) | ||
} | ||
} | ||
|
||
val testmod: SourceSet by sourceSets.creating { | ||
val main: SourceSet = sourceSets["main"] | ||
compileClasspath += main.compileClasspath | ||
compileClasspath += main.output | ||
runtimeClasspath += main.runtimeClasspath | ||
runtimeClasspath += main.output | ||
} | ||
|
||
loom { | ||
runs { | ||
register("testmodClient") { | ||
client() | ||
name ("Testmod Client") | ||
source(testmod) | ||
} | ||
register("testmodServer") { | ||
server() | ||
name("Testmod Server") | ||
source(testmod) | ||
} | ||
register("gametest") { | ||
server() | ||
source(testmod) | ||
ideConfigGenerated(false) // this is meant for CI | ||
vmArg("-Dfabric-api.gametest") | ||
vmArg("-Dfabric-api.gametest.report-file=${layout.buildDirectory}/junit.xml") | ||
runDir("run/gametest_server") | ||
} | ||
} | ||
} | ||
|
||
java { | ||
withSourcesJar() | ||
} | ||
|
||
publishing { | ||
publications { | ||
register<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
} | ||
} | ||
|
||
repositories { | ||
maven("https://mvn.devos.one/snapshots") { | ||
name = "devOsSnapshots" | ||
credentials(PasswordCredentials::class) | ||
} | ||
maven("https://mvn.devos.one/releases") { | ||
name = "devOsReleases" | ||
credentials(PasswordCredentials::class) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,4 @@ | ||
org.gradle.jvmargs=-Xmx2G | ||
|
||
maven_group = io.github.tropheusj | ||
archives_base_name = modid | ||
# <build> is replaced at compile time with either GitHub Actions build number, or 99999 if not available. | ||
mod_version = 0.0.<build> | ||
|
||
# https://fabricmc.net/develop | ||
minecraft_version = 1.21-pre3 | ||
minecraft_dependency = >=1.21-beta.3 | ||
loader_version = 0.15.11 | ||
fabric_version = 0.99.5+1.21 | ||
# https://lambdaurora.dev/tools/import_quilt.html | ||
qm_version = none | ||
# https://parchmentmc.org/docs/getting-started | ||
parchment_version = none | ||
|
||
# dev env mods | ||
|
||
# https://modrinth.com/mod/jade/versions?l=fabric | ||
jade_version = XoEjMfV6 | ||
# https://modrinth.com/mod/modmenu/versions | ||
modmenu_version = 9.0.0-pre.1 | ||
# https://modrinth.com/mod/suggestion-tweaker/versions?l=fabric | ||
suggestion_tweaker_version = 1.20-1.5.1+fabric | ||
# https://modrinth.com/mod/cloth-config/versions?l=fabric | ||
cloth_config_version = 13.0.114+fabric | ||
org.gradle.parallel=true | ||
org.gradle.caching=true | ||
org.gradle.configuration-cache=true |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.