-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
75 lines (63 loc) · 2.08 KB
/
build.gradle.kts
File metadata and controls
75 lines (63 loc) · 2.08 KB
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
import java.util.regex.Pattern
plugins {
`maven-publish`
}
group = "net.ornithemc"
val env: Map<String, String> = System.getenv()
val versionRegex: Pattern = Pattern.compile("version = \"(.*)\"")
version = file("Cargo.toml").useLines { lines ->
lines.map { versionRegex.matcher(it) }.first {
it.matches()
}.group(1)
}
publishing {
publications {
val target = env["TARGET"]
val os = env["OS"]
/*
* Note: this publication depends on files output by
* cargo and environment variables currently only present in the
* "Publish" github action. Running this outside the GHA environment WILL fail.
*/
create<MavenPublication>("mavenCargo") {
groupId = "net.ornithemc.ornithe-installer-rs"
artifactId = "ornithe-installer-rs-$os"
artifact {
file(
"$projectDir/target/$target/release/ornithe-installer-rs." + if (os?.contains("windows") == true) // thanks kotlin
"exe" else "bin"
)
}
artifact (
file(
"$projectDir/target/$target/release/ornithe-installer-rs-cli." + if (os?.contains("windows") == true) // thanks kotlin
"exe" else "bin"
)
) {
classifier = "cli"
}
}
}
repositories {
if (env["MAVEN_URL"] != null) {
repositories.maven {
name = "Release"
url = uri(env["MAVEN_URL"]!!)
credentials {
username = env["MAVEN_USERNAME"]
password = env["MAVEN_PASSWORD"]
}
}
}
/*if (env["SNAPSHOTS_URL"] != null) {
repositories.maven {
name = "Snapshots"
url = uri(env["SNAPSHOTS_URL"]!!)
credentials {
username = env["SNAPSHOTS_USERNAME"]
password = env["SNAPSHOTS_PASSWORD"]
}
}
}*/
}
}