Migrate to Unified Publishing (#274)

* Migrate to Unified Publishing

* Proper changelog md

* Edit workflow
This commit is contained in:
shedaniel
2022-06-13 00:56:07 +08:00
committed by GitHub
parent 796ee4fc14
commit 547f06f45e
4 changed files with 58 additions and 89 deletions

View File

@@ -73,4 +73,4 @@ jobs:
CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
with:
arguments: publish curseforge modrinth --stacktrace --no-daemon
arguments: publish publishUnified --stacktrace --no-daemon

View File

@@ -10,8 +10,7 @@ plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
id "org.cadixdev.licenser" version "0.6.1"
id "com.matthewprenger.cursegradle" version "1.4.0" apply false
id "com.modrinth.minotaur" version "2.2.0" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id "maven-publish"
}
@@ -98,12 +97,12 @@ allprojects {
}
def time = dateFormat.format(new Date())
def changes = new StringBuilder()
changes << "<h2>Architectury v$project.version for $project.supported_version</h2>Updated at <b>$time</b>.<br><a href=\"https://www.github.com/architectury/architectury/commits/$branch\">Click here for changelog</a>"
changes << "## Architectury v$project.version for $project.supported_version\nUpdated at **$time**.\n[Click here for changelog](https://www.github.com/architectury/architectury/commits/$branch)"
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 << "<br>- ${processedLine.capitalize()}"
changes << "\n- ${processedLine.capitalize()}"
}
}
proc.waitFor()

View File

@@ -1,7 +1,6 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.matthewprenger.cursegradle"
id "com.modrinth.minotaur"
id "me.shedaniel.unified-publishing"
}
loom {
@@ -99,51 +98,37 @@ publishing {
}
}
curseforge {
var CURSE_API_KEY = project.findProperty("CURSE_API_KEY") ?: System.getenv("CURSE_API_KEY")
if (CURSE_API_KEY != null) {
apiKey = CURSE_API_KEY
project {
id = rootProject.curseforge_id
releaseType = "$rootProject.artifact_type"
changelogType = "html"
changelog = releaseChangelog()
addGameVersion "1.18.2"
addGameVersion "1.18-Snapshot"
addGameVersion "Java 17"
addGameVersion "Fabric"
relations {
requiredDependency "fabric-api"
}
mainArtifact(remapJar.archivePath) {
displayName = "[Fabric $rootProject.supported_version] v$project.version"
}
afterEvaluate {
uploadTask.dependsOn("build")
}
}
}
options {
forgeGradleIntegration = false
javaVersionAutoDetect = false
}
}
modrinth {
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
token = MODRINTH_TOKEN
projectId = rootProject.modrinth_id
versionType = "$rootProject.artifact_type"
versionNumber = "$project.version+$project.name"
versionName = "[Fabric $rootProject.supported_version] v$project.version"
unifiedPublishing {
project {
displayName = "[Fabric $rootProject.supported_version] v$project.version"
releaseType = "$rootProject.artifact_type"
changelog = releaseChangelog()
uploadFile = remapJar
gameVersions = ["1.18.2"]
loaders = ["fabric", "quilt"]
dependencies {
// TODO: move to slugs if that functionality becomes available in minotaur
required.project("P7dR8mSH") // Fabric API
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", "1.18-Snapshot"
}
}
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"
}
}
}
}

View File

@@ -1,7 +1,6 @@
plugins {
id "com.github.johnrengelman.shadow" version "7.1.2"
id "com.matthewprenger.cursegradle"
id "com.modrinth.minotaur"
id "me.shedaniel.unified-publishing"
}
loom {
@@ -112,45 +111,31 @@ publishing {
}
}
curseforge {
var CURSE_API_KEY = project.findProperty("CURSE_API_KEY") ?: System.getenv("CURSE_API_KEY")
if (CURSE_API_KEY != null) {
apiKey = CURSE_API_KEY
project {
id = rootProject.curseforge_id
releaseType = "$rootProject.artifact_type"
changelogType = "html"
changelog = releaseChangelog()
addGameVersion "1.18.2"
addGameVersion "Java 17"
addGameVersion "Forge"
mainArtifact(remapJar.archivePath) {
displayName = "[Forge $rootProject.supported_version] v$project.version"
}
afterEvaluate {
uploadTask.dependsOn("build")
}
}
}
options {
forgeGradleIntegration = false
javaVersionAutoDetect = false
}
}
modrinth {
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
token = MODRINTH_TOKEN
projectId = rootProject.modrinth_id
versionType = "$rootProject.artifact_type"
versionNumber = "$project.version+$project.name"
versionName = "[Forge $rootProject.supported_version] v$project.version"
unifiedPublishing {
project {
displayName = "[Forge $rootProject.supported_version] v$project.version"
releaseType = "$rootProject.artifact_type"
changelog = releaseChangelog()
uploadFile = remapJar
gameVersions = ["1.18.2"]
loaders = ["forge"]
dependencies {
gameLoaders = ["forge"]
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"
}
}
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"
}
}
}
}