-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.gradle
46 lines (41 loc) · 1.05 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
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 {
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/${System.getenv("GITHUB_REPOSITORY")}")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}