Skip to content

Commit

Permalink
Update from template
Browse files Browse the repository at this point in the history
  • Loading branch information
Crystal0404 committed Oct 12, 2024
1 parent 7e797e2 commit 7dd6e15
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 42 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ on:
type: string
required: false
default: ''
# # [FEATURE] MIXIN_AUDITOR
# mixin_audit:
# description: run mixin audit for Minecraft server after build
# type: boolean
# required: false
# default: false

jobs:
build:
Expand Down Expand Up @@ -51,11 +57,38 @@ jobs:
BUILD_ID: ${{ github.run_number }}
BUILD_RELEASE: ${{ inputs.release }}

# # [FEATURE] MIXIN_AUDITOR
# - name: Run mixin audit check for Minecraft server
# if: ${{ inputs.mixin_audit }}
# timeout-minutes: 10
# run: |
# mkdir -p ./run
# echo eula=true > ./run/eula.txt
# ./gradlew runServerMixinAudit

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: versions/*/build/libs/

# # [FEATURE] FALLENS_MAVEN
# - name: Publish with gradle
# if: inputs.release || github.ref == 'refs/heads/dev'
# run: |
# if [ -z "${{ inputs.target_subproject }}" ]; then
# echo "Publishing all subprojects"
# ./gradlew publish
# else
# args=$(echo "${{ inputs.target_subproject }}" | tr ',' '\n' | sed 's/$/:publish/' | paste -sd ' ')
# echo "Publishing with arguments=$args"
# ./gradlew $args
# fi
# env:
# BUILD_ID: ${{ github.run_number }}
# BUILD_RELEASE: ${{ inputs.release }}
# FALLENS_MAVEN_TOKEN: ${{ secrets.FALLENS_MAVEN_TOKEN }}

summary:
runs-on: ubuntu-22.04
needs:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ on:
- "versions/**"
- ".github/**"
pull_request:
workflow_dispatch:


jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
# # [FEATURE] MIXIN_AUDITOR
# with:
# mixin_audit: true
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,13 @@ jobs:
modrinth-id: G26sLP13
modrinth-token: ${{ secrets.MODRINTH_API_TOKEN }}

# https://legacy.curseforge.com/account/api-tokens
# curseforge-id: 314159
# curseforge-token: ${{ secrets.CF_API_TOKEN }}

github-tag: ${{ steps.release_info.outputs.tag_name }}
github-token: ${{ secrets.GITHUB_TOKEN }}

files: ${{ steps.file_info.outputs.path }}

name: ${{ format('{0} v{1} for mc{2}', steps.properties_g.outputs.mod_name, steps.properties_g.outputs.mod_version, steps.properties_v.outputs.minecraft_version) }}
version: ${{ format('mc{0}-v{1}', steps.properties_v.outputs.minecraft_version, steps.properties_g.outputs.mod_version) }}
version: ${{ format('v{1}-mc{0}', steps.properties_v.outputs.minecraft_version, steps.properties_g.outputs.mod_version) }}
version-type: release

loaders: fabric
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id 'com.replaymod.preprocess' version 'ce1aeb2b'

// https://github.com/Fallen-Breath/yamlang
id 'me.fallenbreath.yamlang' version '1.3.1' apply false
id 'me.fallenbreath.yamlang' version '1.4.0' apply false
}

preprocess {
Expand Down
74 changes: 43 additions & 31 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ preprocess {

repositories {
maven {
url 'https://api.modrinth.com/maven'
url 'https://jitpack.io'
}
maven {
url 'https://maven.fallenbreath.me/releases'
}
maven {
url 'https://jitpack.io'
}
}

// https://github.com/FabricMC/fabric-loader/issues/783
Expand All @@ -34,22 +31,14 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// dependencies
include(modImplementation("me.fallenbreath:conditional-mixin-fabric:${project.conditionalmixin_version}"))
modImplementation "com.github.gnembon:fabric-carpet:${project.carpet_versions}"

final boolean enableFabricAPIInRuntime = false
Set<String> apiModules = [
"fabric-networking-api-v1"
]
apiModules.forEach {
if (enableFabricAPIInRuntime) {
modImplementation(fabricApi.module(it, project.fabric_api))
} else {
modCompileOnly(fabricApi.module(it, project.fabric_api))
}
if (enableFabricAPIInRuntime) {
modImplementation(fabricApi.module("fabric-networking-api-v1", project.fabric_api))
} else {
modCompileOnly(fabricApi.module("fabric-networking-api-v1", project.fabric_api))
}

// MixinExtras
modImplementation "com.github.gnembon:fabric-carpet:${project.carpet_versions}"
include(modImplementation("me.fallenbreath:conditional-mixin-fabric:${project.conditionalmixin_version}"))
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${project.mixinextras_version}")))
}

Expand Down Expand Up @@ -78,13 +67,22 @@ switch (MIXIN_COMPATIBILITY_LEVEL) {
}

loom {
def commonVmArgs = ['-Dmixin.debug.export=true', '-Dcca.enable.debug=true']
runConfigs.configureEach {
// to make sure it generates all "Minecraft Client (:subproject_name)" applications
ideConfigGenerated = true
runDir '../../run'
vmArgs '-Dmixin.debug.export=true'
vmArgs '-Dcca.enable.debug=true'
vmArgs commonVmArgs
}
// // [FEATURE] MIXIN_AUDITOR
// runs {
// def auditVmArgs = [*commonVmArgs, '-DmixinAuditor.audit=true']
// serverMixinAudit {
// server()
// vmArgs auditVmArgs
// ideConfigGenerated false
// }
// }
}

remapJar {
Expand All @@ -93,32 +91,35 @@ remapJar {

String modVersionSuffix = ''
String artifactVersion = project.mod_version
String artifactVersionSuffix = ''
// 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")
modVersionSuffix += buildNumber != null ? ('+build.' + buildNumber) : '-SNAPSHOT'
artifactVersion += '-SNAPSHOT' // A non-release artifact is always a SNAPSHOT artifact
artifactVersionSuffix = '-SNAPSHOT' // A non-release artifact is always a SNAPSHOT artifact
}
String finalModVersion = project.mod_version + modVersionSuffix
String fullModVersion = 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)
// project.mod_version 1.0.3 (the base mod version)
// modVersionSuffix +build.88 (use github action build number if possible)
// artifactVersionSuffix -SNAPSHOT
// fullModVersion 1.0.3+build.88 (the actual mod version to use in the mod)
// fullProjectVersion v1.0.3-mc1.15.2+build.88 (in build output jar name)
// fullArtifactVersion 1.0.3-mc1.15.2-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
fullProjectVersion = 'v' + finalModVersion
fullArtifactVersion = 'v' + artifactVersion
fullProjectVersion = 'v' + project.mod_version + modVersionSuffix
fullArtifactVersion = artifactVersion + artifactVersionSuffix
} else {
base.archivesName = project.archives_base_name
fullProjectVersion = 'mc' + project.minecraft_version + '-v' + finalModVersion
fullArtifactVersion = 'mc' + project.minecraft_version + '-v' + artifactVersion
fullProjectVersion = 'v' + project.mod_version + '-mc' + project.minecraft_version + modVersionSuffix
fullArtifactVersion = artifactVersion + '-mc' + project.minecraft_version + artifactVersionSuffix
}
version = fullProjectVersion

Expand Down Expand Up @@ -226,13 +227,24 @@ publishing {
mavenJava(MavenPublication) {
artifactId base.archivesName.get()
from components.java
version = fullArtifactVersion
version = fullArtifactVersion
}
}

// select the repositories you want to publish to
repositories {
// mavenLocal()

// // [FEATURE] FALLENS_MAVEN
// maven {
// url = fullArtifactVersion.endsWith("SNAPSHOT") ? "https://maven.fallenbreath.me/snapshots" : "https://maven.fallenbreath.me/releases"
// credentials(PasswordCredentials) {
// username = 'fallen'
// password = System.getenv("FALLENS_MAVEN_TOKEN")
// }
// authentication {
// basic(BasicAuthentication)
// }
// }
}
}
8 changes: 4 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ pluginManagement {
name = 'Ali'
url = 'https://maven.aliyun.com/repository/gradle-plugin'
}
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Jitpack'
url = 'https://jitpack.io'
}
mavenCentral()
gradlePluginPortal()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
}
resolutionStrategy {
eachPlugin {
Expand Down

0 comments on commit 7dd6e15

Please sign in to comment.