Skip to content

Commit

Permalink
feat: add automatic mod publishing
Browse files Browse the repository at this point in the history
don't tell rai where I got the code from

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
  • Loading branch information
Octol1ttle committed Jun 13, 2024
1 parent d87027f commit 5af5b4f
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 4 deletions.
Empty file added CHANGELOG.md
Empty file.
87 changes: 85 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'me.fallenbreath.yamlang' version '1.3.1'
id 'me.modmuss50.mod-publish-plugin' version '0.5.1'
}

version = project.mod_version
version = "${project.mod_version}-dev+mc${project.minecraft_version}"
group = project.maven_group

base {
Expand Down Expand Up @@ -96,4 +97,86 @@ jar {
from("LICENSE") {
rename { "${it}_${project.base.archivesName.get()}"}
}
}
}

publishMods {
file = remapJar.archiveFile
version = project.version
changelog = getRootProject().file("CHANGELOG.md").text
type = STABLE
modLoaders.add("fabric")

def min = property('publish_target_min')
def max = property('publish_target_max')

def minecraftVersion = min == max ? min : "${min}-${max}"
displayName = "FlightAssistant ${property('mod_version')} (MC ${minecraftVersion})"

if (providers.gradleProperty('modrinthToken').present) {
modrinth {
projectId = property('mod_modrinth')
accessToken = providers.gradleProperty('modrinthToken').get()

if (min == max) {
minecraftVersions.add(min)
} else {
minecraftVersionRange {
start = min
end = max
}
}

requires {
slug = "fabric-api"
}
requires {
slug = "yacl"
}
optional {
slug = "modmenu"
}
optional {
slug = "immediatelyfast"
}
}
}

if (providers.gradleProperty('curseforgeToken').present) {
curseforge {
projectId = property('mod_curseforge')
accessToken = providers.gradleProperty('curseforgeToken').get()

if (min == max) {
minecraftVersions.add(min)
} else {
minecraftVersionRange {
start = min
end = max
}
}

requires {
slug = "fabric-api"
}
requires {
slug = "yacl"
}
optional {
slug = "modmenu"
}
optional {
slug = "immediatelyfast"
}
}
}

if (providers.gradleProperty('githubToken').present) {
github {
repository = property('mod_github')
accessToken = providers.gradleProperty('githubToken').get()

commitish = property('git_branch')
tagName = project.version
}
}
}
11 changes: 9 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.4+build.3
floader_version=0.15.3

# Mod Properties
mod_version=2.3.0-dev+mc1.20.4
mod_version=2.3.0
maven_group=ru.octol1ttle.flightassistant
archives_base_name=flightassistant

Expand All @@ -19,4 +19,11 @@ fapi_version=0.96.4
yacl_version=3.3.1
modmenu_version=9.0.0
immediatelyfast_version=1.2.8
dabr_version=3.3.8
dabr_version=3.3.8
# Publish Properties
publish_target_min=1.20
publish_target_max=1.20.4
mod_modrinth=CWqLEOPt
mod_curseforge=972881
mod_github=Octol1ttle/FlightAssistant
git_branch=dev

0 comments on commit 5af5b4f

Please sign in to comment.