[ATTEMPT] automate modrinth publication

This commit is contained in:
JFronny 2020-12-12 14:00:36 +01:00
parent 956f3a3d04
commit 5054e64d9a
2 changed files with 19 additions and 18 deletions

View File

@ -6,7 +6,7 @@ variables:
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
deploy:
build_test:
stage: deploy
script:
- gradle --build-cache assemble
@ -19,3 +19,8 @@ deploy:
- latest.jar
only:
- master
modrinth:
stage: deploy
when: manual
script: gradle --build-cache publishModrinth

View File

@ -1,6 +1,7 @@
plugins {
id 'fabric-loom' version '0.5.42'
id 'maven-publish'
id "com.modrinth.minotaur" version "1.1.0"
}
sourceCompatibility = JavaVersion.VERSION_1_8
@ -72,23 +73,18 @@ jar {
from "LICENSE"
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
import com.modrinth.minotaur.TaskModrinthUpload
// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
// mavenLocal()
task publishModrinth (type: TaskModrinthUpload){
token = System.getenv("MODRINTH_API_TOKEN") // Use an environment property!
projectId = 'TiF5QWZY'
versionNumber = "${project.mod_version}"
uploadFile = remapJar // This is the java jar task
addGameVersion("${project.minecraft_version}")
addLoader('fabric')
versionName = "[${project.minecraft_version}] ${project.mod_version}"
afterEvaluate {
tasks.publishModrinth.dependsOn(remapJar)
tasks.publishModrinth.dependsOn(sourcesJar)
}
}