/
minecraftbackup
/
ViaRewind
Обзор
Документация
Войти
/
minecraftbackup
/
ViaRewind
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
build.gradle
142 строки
4 KB
github-actions[bot]
Update Gradle Wrapper from 8.10.2 to 8.11 (#549)
15 ноя 2024, 01:28
Не верифицирован
15 ноя 2024, 01:28
3fd2da9
Код
Авторство
О чём код?
plugins { id "vr.base-conventions" id "io.papermc.hangar-publish-plugin" version "0.1.2" id "com.modrinth.minotaur" version "2.+" } base { archivesName = "ViaRewind" } configurations { publishInclude } dependencies { publishInclude project(":viarewind-common") publishInclude project(":viarewind-bukkit") publishInclude project(":viarewind-fabric") publishInclude project(":viarewind-sponge") publishInclude project(":viarewind-velocity") } jar { dependsOn configurations.publishInclude from { duplicatesStrategy = DuplicatesStrategy.EXCLUDE configurations.publishInclude.collect { zipTree(it) } } { exclude "META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA" } manifest { attributes( "paperweight-mappings-namespace": "mojang" ) } from("LICENSE") { rename { "${it}_${project.name ?: rootProject.name}" } } } idea { module { ["run"].each { excludeDirs << file("$it") } } } // ----------------------------------------------------- // Publishing Provider<String> latestCommitHash() { return providers.exec { commandLine = ["git", "rev-parse", "--short", "HEAD"] }.standardOutput.getAsText().map(String::trim) } Provider<String> latestCommitMessage() { return providers.exec { commandLine = ["git", "log", "-1", "--pretty=%B"] }.standardOutput.getAsText().map(String::trim) } Provider<String> branchName() { return providers.exec { commandLine = ["git", "rev-parse", "--abbrev-ref", "HEAD"] }.standardOutput.getAsText().map(String::trim) } def branch = branchName().get() def baseVersion = project.maven_version def isRelease = !baseVersion.contains('-') def isMainBranch = branch == "master" if (!isRelease || isMainBranch) { // Only publish releases from the main branch def suffixedVersion = isRelease ? baseVersion : baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER") def commitHash = latestCommitHash().get() def changelogContent = "[${commitHash}](https://github.com/ViaVersion/ViaRewind/commit/${commitHash}) ${latestCommitMessage().get()}" modrinth { def mcVersions = project.mcVersions .split(',') .collect { it.trim() } token.set(System.getenv("MODRINTH_TOKEN")) projectId.set("viarewind") versionType.set(isRelease ? "release" : isMainBranch ? "beta" : "alpha") versionNumber.set(suffixedVersion) versionName.set(suffixedVersion) changelog.set(changelogContent) uploadFile.set(jar.archiveFile) gameVersions.set(mcVersions) loaders.add("fabric") loaders.add("paper") loaders.add("folia") loaders.add("velocity") autoAddDependsOn.set(false) detectLoaders.set(false) dependencies { required.project("viaversion") required.project("viabackwards") optional.project("viafabric") } } hangarPublish { publications.register("plugin") { version = suffixedVersion id = "ViaRewind" channel = isRelease ? "Release" : isMainBranch ? "Snapshot" : "Alpha" changelog = changelogContent apiKey = System.getenv("HANGAR_TOKEN") platforms { PAPER { jar = project.jar.archiveFile platformVersions = [property('mcVersionRange') as String] dependencies { hangar("ViaVersion") { required = true } hangar("ViaBackwards") { required = true } } } VELOCITY { jar = project.jar.archiveFile platformVersions = [property("velocityVersion") as String] dependencies { hangar("ViaVersion") { required = true } hangar("ViaBackwards") { required = true } } } } } } }