forked from junit-team/junit5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gh-pages.gradle
57 lines (48 loc) · 1.43 KB
/
gh-pages.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
apply plugin: "org.ajoberstar.git-publish"
def docsDir = file("$buildDir/ghpages-docs")
def replaceCurrentDocs = project.hasProperty('replaceCurrentDocs')
task prepareDocsForUploadToGhPages(type: Copy) {
dependsOn 'aggregateJavadocs', ':documentation:asciidoctor'
outputs.dir docsDir
from("${project(':documentation').buildDir}/asciidoc") {
include 'user-guide/**'
include 'release-notes/**'
}
from("$buildDir/docs") {
include 'javadoc/**'
filesMatching("**/*.html") {
def favicon = '<link rel="icon" type="image/png" href="http://junit.org/junit5/assets/img/junit5-logo.png">'
filter { line ->
line.startsWith("<head>") ? line.replace("<head>", "<head>$favicon") : line
}
}
}
into "${docsDir}/${docsVersion}"
filesMatching('javadoc/**') { fileCopyDetails ->
fileCopyDetails.path = fileCopyDetails.path.replace('javadoc/', 'api/')
}
includeEmptyDirs = false
}
task createCurrentDocsFolder(type: Copy) {
dependsOn prepareDocsForUploadToGhPages
outputs.dir "${docsDir}/current"
onlyIf { replaceCurrentDocs }
from "${docsDir}/${docsVersion}"
into "${docsDir}/current"
}
gitPublish {
repoUri = 'https://github.com/junit-team/junit5.git'
branch = 'gh-pages'
contents {
from docsDir
into "docs"
}
preserve {
include '**/*'
exclude "docs/${docsVersion}/**"
if (replaceCurrentDocs) {
exclude "docs/current/**"
}
}
}
gitPublishCommit.dependsOn(prepareDocsForUploadToGhPages, createCurrentDocsFolder)