-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: Setup automatic Hangar and Modrinth publishing
- Loading branch information
Showing
13 changed files
with
116 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
import org.gradle.api.Project | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.tasks.bundling.AbstractArchiveTask | ||
import org.gradle.kotlin.dsl.property | ||
|
||
abstract class MiniMOTDPlatformExtension(project: Project) { | ||
val jarTask: Property<AbstractArchiveTask> = project.objects.property() | ||
interface MiniMOTDPlatformExtension { | ||
val jarTask: Property<AbstractArchiveTask> | ||
val hangar: Property<Boolean> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
import net.kyori.indra.git.IndraGitExtension | ||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import org.gradle.api.Project | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.kotlin.dsl.the | ||
|
||
fun Project.lastCommitHash(): String = | ||
the<IndraGitExtension>().commit()?.name?.substring(0, 7) ?: "unknown" | ||
|
||
val Project.libs: LibrariesForLibs | ||
get() = the() | ||
|
||
val Project.releaseNotes: Provider<String> | ||
get() = providers.environmentVariable("RELEASE_NOTES") | ||
|
||
val Project.minecraftVersion | ||
get() = libs.versions.minecraft.get() | ||
|
||
val bukkitVersions = listOf( | ||
"1.8.8", | ||
"1.8.9", | ||
"1.9.4", | ||
"1.10.2", | ||
"1.11.2", | ||
"1.12.2", | ||
"1.13.2", | ||
"1.14.4", | ||
"1.15.2", | ||
"1.16.5", | ||
"1.17.1", | ||
"1.18.2", | ||
"1.19.4" | ||
) |
32 changes: 32 additions & 0 deletions
32
build-logic/src/main/kotlin/minimotd.build-logic.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,35 @@ | ||
import io.papermc.hangarpublishplugin.model.Platforms | ||
|
||
plugins { | ||
base | ||
id("io.papermc.hangar-publish-plugin") | ||
} | ||
|
||
fun jar(platform: String) = project(":minimotd-$platform") | ||
.the<MiniMOTDPlatformExtension>().jarTask.flatMap { it.archiveFile } | ||
|
||
hangarPublish.publications.register("plugin") { | ||
version.set(project.version as String) | ||
namespace("jmp", "MiniMOTD") | ||
channel.set("Release") | ||
changelog.set(releaseNotes) | ||
apiKey.set(providers.environmentVariable("HANGAR_UPLOAD_KEY")) | ||
platforms { | ||
register(Platforms.PAPER) { | ||
jar.set(jar("bukkit")) | ||
val vers = bukkitVersions.toMutableList() | ||
vers -= "1.8.8" | ||
vers -= "1.8.9" | ||
vers += "1.8" | ||
platformVersions.addAll(vers) | ||
} | ||
register(Platforms.VELOCITY) { | ||
jar.set(jar("velocity")) | ||
platformVersions.addAll("3.2") | ||
} | ||
register(Platforms.WATERFALL) { | ||
jar.set(jar("bungeecord")) | ||
platformVersions.addAll("1.19") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,8 @@ tasks { | |
commonRelocation("org.bstats") | ||
} | ||
} | ||
|
||
modrinth { | ||
loaders.add("sponge") | ||
gameVersions.add("1.12.2") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,12 @@ tasks { | |
} | ||
} | ||
} | ||
|
||
modrinth { | ||
gameVersions.addAll( | ||
"1.16.5", | ||
"1.17.1", | ||
"1.18.2", | ||
"1.19.4" | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,7 @@ blossom { | |
replaceToken("\${$k}", v, file) | ||
} | ||
} | ||
|
||
modrinth { | ||
gameVersions.addAll(minecraftVersion) | ||
} |