Publish to modrinth when a new release is built

This commit is contained in:
Sollace 2021-12-04 15:41:26 +02:00
parent c66d00c44e
commit 06da7338b1
4 changed files with 45 additions and 2 deletions

View file

@ -1,4 +1,4 @@
name: Publish To Maven
name: Publish
on:
push:
tags:
@ -25,3 +25,10 @@ jobs:
uses: eskatos/gradle-command-action@v1
with:
arguments: build publish
- name: Publish Modrinth Jar
env:
MODRINTH_KEY: ${{ secrets.MODRINTH_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: eskatos/gradle-command-action@v1
with:
arguments: publishModrinth

View file

@ -1,9 +1,16 @@
buildscript {
dependencies {
classpath 'com.github.dexman545:Outlet:1.2.0'
}
}
plugins {
id 'java-library'
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
id 'com.modrinth.minotaur' version '1.1.0'
id 'org.ajoberstar.reckon' version '0.13.0'
}
apply plugin: 'dex.plugins.outlet'
java {
toolchain {
@ -11,6 +18,9 @@ java {
}
}
outlet.allowSnapshotsForProject = false
outlet.mcVersionRange = project.minecraft_version_range
group = project.group
description = project.displayname
archivesBaseName = project.name
@ -102,6 +112,23 @@ task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
}
import com.modrinth.minotaur.TaskModrinthUpload
task publishModrinth (type: TaskModrinthUpload){
onlyIf {
def stage = version.version.stage.value
stage != null && stage.name != 'beta'
}
token = System.env.MODRINTH_KEY
projectId = project.modrinth_project_id
versionNumber = version.toString()
uploadFile = jar.outputs.getFiles().asPath // This is the java jar task
addLoader(project.modrinth_loader_type)
outlet.mcVersions().each{ver ->
addGameVersion ver
}
}
publishing {
publications {
maven(MavenPublication) {
@ -109,7 +136,7 @@ publishing {
pom {
name = "MineLittlePony"
description = "HD Skins support for Minecraft"
description = "Ponify your Minecraft experience!"
url = "https://minelittlepony-mod.com"
licenses {
license {

View file

@ -14,6 +14,11 @@ org.gradle.daemon=false
authors=Verdana, Rene_Z, Mumfrey, Killjoy1221, Sollace
description=Mine Little Pony turns players and mobs into ponies. Press F9 ingame to access settings.
# Publishing
minecraft_version_range=>=1.18
modrinth_loader_type=fabric
modrinth_project_id=JBjInUXM
# Dependencies
modmenu_version=2.0.0-beta.7
kirin_version=1.10.0

View file

@ -5,6 +5,10 @@ pluginManagement {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Jitpack'
url = 'https://jitpack.io'
}
gradlePluginPortal()
}
}