forked from CJCrafter/AutoSupport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
99 lines (83 loc) · 2.38 KB
/
build.gradle.kts
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
92
93
94
95
96
97
98
99
import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask
group = "me.cjcrafter"
version = "1.1.1"
plugins {
`java-library`
`maven-publish`
id("com.github.breadmoirai.github-release") version "2.4.1"
}
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-alpha.18")
implementation("com.googlecode.json-simple:json-simple:1.1.1")
testImplementation("org.junit.jupiter:junit-jupiter:5.9.0")
}
java {
withSourcesJar()
withJavadocJar()
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
tasks {
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
options.release.set(17)
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
}
}
tasks.test {
useJUnitPlatform()
}
tasks.register("releaseAutoSupport").configure {
dependsOn(":publish")
finalizedBy(":createGithubRelease")
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/CJCrafter/AutoSupport")
credentials {
username = findProperty("user").toString()
password = findProperty("pass").toString()
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = "me.cjcrafter"
artifactId = "autosupport" // MUST be lowercase
from(components["java"])
}
}
}
tasks.register<GithubReleaseTask>("createGithubRelease").configure {
// https://github.com/BreadMoirai/github-release-gradle-plugin
owner.set("CJCrafter")
repo.set("AutoSupport")
authorization.set("Token ${findProperty("pass").toString()}")
tagName.set("$version")
targetCommitish.set("main")
releaseName.set("v${version}")
draft.set(true)
prerelease.set(false)
generateReleaseNotes.set(true)
body.set("")
overwrite.set(false)
allowUploadToExisting.set(false)
apiEndpoint.set("https://api.github.com")
setReleaseAssets(file("/build/libs/AutoSupport-$version"))
// If set to true, you can debug that this would do
dryRun.set(false)
doFirst {
println("Creating GitHub release")
}
}