-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
91 lines (74 loc) · 2.36 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
buildscript { dependencies { classpath 'org.kohsuke:github-api:1.+' } }
plugins {
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'dev.architectury.loom' version '1.0-SNAPSHOT' apply false
}
architectury {
minecraft = rootProject.ver_minecraft
}
subprojects {
apply plugin: 'dev.architectury.loom'
loom {
silentMojangMappingsLicense()
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.ver_minecraft}"
mappings "net.fabricmc:yarn:${rootProject.ver_minecraft}+build.${rootProject.ver_yarn}:v2"
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'architectury-plugin'
apply plugin: 'maven-publish'
archivesBaseName = project.name == rootProject.name ? rootProject.mod_id : rootProject.mod_id + "-" + project.name
group = rootProject.maven_group
def ENV = System.getenv()
String ver = "${rootProject.version_id}+${rootProject.major_version}"
version = ENV.GITHUB_ACTIONS ? "${ver}.build.${ENV.GITHUB_RUN_NUMBER}" : ver
repositories {
maven {
name = 'Terraformers'
url = 'https://maven.terraformersmc.com/releases/'
}
maven {
name = 'Shedaniel'
url = 'https://maven.shedaniel.me/'
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.release = 17
}
java {
withSourcesJar()
}
}
/* Releasing */
def ENV = System.getenv()
def VER_NAME = "[$rootProject.major_version] $rootProject.mod_name $rootProject.version_id"
def CHANGELOG = new File("./gradle", "CHANGELOG.md").text
def SUPPORTED_VERSIONS = rootProject.supported_versions.split(',')
def PLATFORMS = rootProject.enabled_platforms.split(",")
import org.kohsuke.github.*
task github(dependsOn: build) {
onlyIf { ENV.GITHUB_TOKEN }
doLast {
def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN)
def repository = github.getRepository(rootProject.github_repository)
def builder = new GHReleaseBuilder(repository, version)
builder.name(VER_NAME)
builder.body(CHANGELOG)
builder.commitish(rootProject.github_branch)
builder.prerelease(rootProject.beta)
def release = builder.create()
for (final def platform in PLATFORMS) {
release.uploadAsset(
new File(
"./$platform/build/libs",
"${archivesBaseName}-${platform}-${version}.jar"
),
"application/java-archive"
)
}
}
}