-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
57 lines (47 loc) · 1.6 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
ext {
commitHash = System.getenv("SYSTEM_PULLREQUEST_SOURCECOMMITID")?.substring(0, 7)
isReleaseBuild = !version.toString().toLowerCase().contains("snapshot")
isPreRelease = version.toString().contains("next")
if (commitHash == null || commitHash.isEmpty()) {
commitHash = System.getenv("BUILD_SOURCEVERSION")?.substring(0, 7)
if (commitHash == null || commitHash.isEmpty()) {
commitHash = "git rev-parse --short HEAD".execute().text.trim()
}
}
}
group = "ch.schulealtendorf.psa"
allprojects() {
group = project.rootProject.group
repositories {
mavenCentral()
}
}
// Check if release files are ready
task checkRelease() {
doLast {
if (!isReleaseBuild) {
return
}
if (isPreRelease) {
return
}
def errors = []
// Check release notes
def releaseNotes = file("RelNotes/${version}.md")
if (!releaseNotes.exists()) {
errors.add("Release notes for version ${version} do not exist")
}
// Check Changelog
def changelogError = "Changelog is missing release version ${version}"
errors.add(changelogError)
file("CHANGELOG.md").eachLine { line ->
if (line.matches("## \\[${version}] - \\d{4}-\\d{2}-\\d{2}")) {
errors.remove(changelogError)
}
}
if (errors.size() > 0) {
errors.forEach { error -> println(error) }
throw new RuntimeException("Some release files are not correct. Check the log output for more information!")
}
}
}