Automatic upload using Unified Publishing

This commit is contained in:
Martin Prokoph
2024-02-22 15:01:05 +01:00
parent 41a4ddf633
commit f3fb019bca
4 changed files with 79 additions and 20 deletions

View File

@@ -1,6 +1,7 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
}
architectury {
@@ -50,6 +51,21 @@ allprojects {
options.encoding = "UTF-8"
options.release = 17
}
ext {
releaseChangelog = {
def changes = new StringBuilder()
changes << "## CullLeaves v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/CullLeaves/commits/)"
def proc = "git log --max-count=200 --pretty=format:%s".execute()
proc.in.eachLine { line ->
def processedLine = line.toString()
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
changes << "\n- ${processedLine.capitalize()}"
}
}
proc.waitFor()
return changes.toString()
}
}
java {
withSourcesJar()

View File

@@ -1,5 +1,6 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "me.shedaniel.unified-publishing"
}
architectury {
@@ -72,16 +73,38 @@ components.java {
}
}
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = archives_base_name + "-" + project.name
from components.java
unifiedPublishing {
project {
displayName = "CullLeaves v$project.version - Fabric $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["fabric","quilt"]
mainPublication remapJar
relations {
depends {
curseforge = "fabric-api"
modrinth = "fabric-api"
}
}
var CURSE_API_KEY = project.findProperty("CURSE_API_KEY") ?: System.getenv("CURSE_API_KEY")
if (CURSE_API_KEY != null) {
curseforge {
token = CURSE_API_KEY
id = rootProject.curseforge_id
gameVersions.addAll "Java 17", project.minecraft_version
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -7,6 +7,9 @@ enabled_platforms=fabric,neoforge
archives_base_name=cullleaves
mod_version=3.3.0
maven_group=eu.midnightdust
release_type=release
curseforge_id=423254
modrinth_id=GNxdLCoP
midnightlib_version=1.5.3
sodium_version=mc1.20.4-0.5.8

View File

@@ -1,5 +1,6 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "me.shedaniel.unified-publishing"
}
architectury {
@@ -67,16 +68,32 @@ components.java {
}
}
publishing {
publications {
mavenNeoForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
unifiedPublishing {
project {
displayName = "CullLeaves v$project.version - NeoForge $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["neoforge"]
mainPublication remapJar
var CURSE_API_KEY = project.findProperty("CURSE_API_KEY") ?: System.getenv("CURSE_API_KEY")
if (CURSE_API_KEY != null) {
curseforge {
token = CURSE_API_KEY
id = rootProject.curseforge_id
gameVersions.addAll "Java 17", project.minecraft_version
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}