Skip to content

Commit

Permalink
Modrinth
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyxlandlee committed Jun 28, 2024
1 parent faaa2c1 commit 0bb163b
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 4 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build / Publish to Modrinth

on:
push:
branches:
- 1.21-all

jobs:
build:
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, '[ci build]')
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Build with Gradle
run: ./gradlew build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: '**/build/libs/*'
if-no-files-found: ignore

publish:
runs-on: ubuntu-latest
if: startsWith(github.event.head_commit.message, '[ci publish]')
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Set up Modrinth token
run: echo "MR_TOKEN=${{ secrets.MODRINTH_TOKEN }}" >> $GITHUB_ENV

- name: Publish to Modrinth
run: ./gradlew modrinth

- name: Upload publish artifacts
uses: actions/upload-artifact@v4
with:
name: publish-artifacts
path: '**/build/libs/*'
if-no-files-found: ignore
37 changes: 36 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
plugins {
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'dev.architectury.loom' version '1.6-SNAPSHOT'
id ("com.github.johnrengelman.shadow") version "7.1.2" apply false
id "com.github.johnrengelman.shadow" version "7.1.2" apply false
id "com.modrinth.minotaur" version "2.+" apply false

id 'maven-publish'
}
Expand Down Expand Up @@ -168,6 +169,40 @@ subprojects { p ->
}
}

subprojects {
if (System.getenv("MR_TOKEN")) {
apply plugin: 'com.modrinth.minotaur'
def modLoaders = project.mr_loader.toString().split(",") as List
modrinth {
token.set System.getenv("MR_TOKEN")
projectId.set rootProject.mr_project_id
versionNumber.set "${project.version}-${modLoaders[0]}"
versionName.set String.format(
/*format=*/rootProject.mr_version_name_format.toString(),
rootProject.mr_version_game_range,
project.mr_loader_display,
rootProject.mr_version_mod_abbr,
rootProject.mr_version_display
)
changelog.set rootProject.mr_version_changelog
versionType.set rootProject.mr_version_type
gameVersions = rootProject.mr_version_game.toString().split(",") as List
loaders.set modLoaders
detectLoaders.set false
autoAddDependsOn.set false

dependencies {
optional.project 'remote-resource-pack'
}

uploadFile.set tasks.remapJar
additionalFiles = [tasks.remapSourcesJar]

debugMode = System.getenv("MR_DEBUG_MODE") == '1'
}
}
}

// configure the maven publication
publishing {
publications {
Expand Down
2 changes: 2 additions & 0 deletions fabric/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mr_loader=fabric,quilt
mr_loader_display=Fabric
5 changes: 4 additions & 1 deletion forge/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
loom.platform=forge
loom.platform=forge

mr_loader=forge
mr_loader_display=MCF
11 changes: 10 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@ org.gradle.jvmargs=-Xmx2G
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.21
fabric_loader_version=0.15.11
#yarn_mappings=1.19.4+build.2
# Mod Properties
mod_version=3.1.2+1.21
maven_group=xland.mcmod
archives_base_name=end-poem-extension

forge_version=1.21-51.0.17
neo_version=21.0.30-beta

mr_project_id=es432VKT
mr_version_display=3.1.2
mr_version_mod_abbr=EPX
mr_version_game_range=1.21
# 1: MC version range, 2: loader name, 3: mod abbreviation 4: version displayed
mr_version_name_format=[%1$s %2$s] %3$s %4$s
mr_version_changelog=
mr_version_type=release
mr_version_game=1.21
5 changes: 4 additions & 1 deletion neo/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
loom.platform=neoforge
loom.platform=neoforge

mr_loader=neoforge
mr_loader_display=NeoForge

0 comments on commit 0bb163b

Please sign in to comment.