Skip to content

Commit

Permalink
update from mod template
Browse files Browse the repository at this point in the history
f20d0fadf703564beafe10bd5b8816b282bdfcc1
  • Loading branch information
Fallen-Breath committed May 28, 2024
1 parent bfefacc commit 40fa27b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: step.build
name: _step.build

on:
workflow_call:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/matrix_prep.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: step.matrix_prepare
name: _step.matrix_prepare

on:
workflow_call:
Expand Down
35 changes: 21 additions & 14 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,7 @@ if (mcVersion >= 12005) {
} else {
JAVA_COMPATIBILITY = JavaVersion.VERSION_1_8
}

// mixin does not support java 21 yet
JavaVersion MIXIN_COMPATIBILITY_LEVEL = JAVA_COMPATIBILITY
if (MIXIN_COMPATIBILITY_LEVEL > JavaVersion.VERSION_17) {
MIXIN_COMPATIBILITY_LEVEL = JavaVersion.VERSION_17
}

loom {
accessWidenerPath = file("tweakermore.accesswidener")
Expand All @@ -131,24 +126,36 @@ remapJar {
remapperIsolation = true
}

String versionSuffix = ''
String modVersionSuffix = ''
String artifactVersion = project.mod_version
// detect github action environment variables
// https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables
if (System.getenv("BUILD_RELEASE") != "true") {
String buildNumber = System.getenv("BUILD_ID")
versionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '-SNAPSHOT'
modVersionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '-SNAPSHOT'
artifactVersion += '-SNAPSHOT' // A non-release artifact is always a SNAPSHOT artifact
}
String fullModVersion = project.mod_version + versionSuffix
String finalModVersion = project.mod_version + modVersionSuffix
String fullProjectVersion, fullArtifactVersion

// Example version values:
// project.mod_version 1.0.3 (the base mod version)
// finalModVersion 1.0.3+build.88 (the actual mod version to use)
// fullProjectVersion mc1.15.2-v1.0.3+build.88 (in build output jar name)
// fullArtifactVersion mc1.15.2-v1.0.3-SNAPSHOT (maven artifact version)

group = project.maven_group
if (System.getenv("JITPACK") == "true") {
// move mc version into archivesBaseName, so jitpack will be able to organize archives from multiple subprojects correctly
base.archivesName = project.archives_base_name + '-mc' + project.minecraft_version
version = 'v' + fullModVersion
fullProjectVersion = 'v' + finalModVersion
fullArtifactVersion = 'v' + artifactVersion
} else {
base.archivesName = project.archives_base_name
version = 'mc' + project.minecraft_version + '-v' + fullModVersion
fullProjectVersion = 'mc' + project.minecraft_version + '-v' + finalModVersion
fullArtifactVersion = 'mc' + project.minecraft_version + '-v' + artifactVersion
}
version = fullProjectVersion

// See https://youtrack.jetbrains.com/issue/IDEA-296490
// if IDEA complains about "Cannot resolve resource filtering of MatchingCopyAction" and you want to know why
Expand All @@ -157,14 +164,14 @@ processResources {

inputs.property "id", project.mod_id
inputs.property "name", project.mod_name
inputs.property "version", fullModVersion
inputs.property "version", finalModVersion
inputs.property "minecraft_dependency", project.minecraft_dependency

filesMatching("fabric.mod.json") {
def valueMap = [
"id": project.mod_id,
"name": project.mod_name,
"version": fullModVersion,
"version": finalModVersion,
"minecraft_dependency": project.minecraft_dependency,
"malilib_dependency": project.malilib_dependency,
]
Expand Down Expand Up @@ -261,8 +268,8 @@ publishing {
publications {
mavenJava(MavenPublication) {
artifactId base.archivesName.get()

from components.java
version = fullArtifactVersion
}
}

Expand All @@ -271,7 +278,7 @@ publishing {
// mavenLocal()

maven {
url = version.endsWith("SNAPSHOT") ? "https://maven.fallenbreath.me/snapshots" : "https://maven.fallenbreath.me/releases"
url = fullArtifactVersion.endsWith("SNAPSHOT") ? "https://maven.fallenbreath.me/snapshots" : "https://maven.fallenbreath.me/releases"
credentials(PasswordCredentials) {
username = 'fallen'
password = System.getenv("FALLENS_MAVEN_TOKEN")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Fabric Basic Properties
# https://fallen-breath.github.io/fabric-versions/
loader_version=0.15.10
loader_version=0.15.11

# Mod Properties
mod_id = tweakermore
Expand Down

0 comments on commit 40fa27b

Please sign in to comment.