-
Notifications
You must be signed in to change notification settings - Fork 14
/
publish.gradle
53 lines (47 loc) · 1.3 KB
/
publish.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
apply plugin: 'maven-publish'
def getBranch() {
def process = 'git branch --show-current'.execute()
process.waitFor()
return process.text.trim()
}
def getHash() {
def process = 'git rev-parse HEAD'.execute()
process.waitFor()
return process.text.trim()
}
java {
withJavadocJar()
withSourcesJar()
}
jar {
manifest {
attributes (
'Build-Jdk': "${System.properties['java.vendor']} ${System.properties['java.vm.version']}",
'Created-By': "Gradle ${gradle.gradleVersion}",
'Git-Branch': getBranch(),
'Git-Hash': getHash()
)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/${project.findProperty("GITHUB_REPOSITORY")?: System.getenv("GITHUB_REPOSITORY")}")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
javadoc {
if(JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}