Skip to content

Commit

Permalink
Publish docs to GitHub Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscoo committed Nov 27, 2020
1 parent 62652f4 commit a5b4bb2
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions documentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,34 @@ plugins {
`java-library-conventions`
id("com.diffplug.spotless")
id("org.asciidoctor.jvm.convert")
id("org.ajoberstar.git-publish")
}

description = "CXF Codegen documentation"

val snapshot = rootProject.version.toString().contains("SNAPSHOT")
val docsVersion = if (snapshot) "snapshot" else rootProject.version
val docsDir = file("$buildDir/ghpages-docs")
val replaceCurrentDocs = project.hasProperty("replaceCurrentDocs")

gitPublish {
repoUri.set("https://github.com/ciscoo/cxf-codegen-gradle.git")
branch.set("gh-pages")

contents {
from(docsDir)
into("docs")
}

preserve {
include("**/*")
exclude("docs/$docsVersion/**")
if (replaceCurrentDocs) {
exclude("docs/current/**")
}
}
}

tasks {
val copyJavadoc by registering(Copy::class) {
from("$rootDir/cxf-codegen-gradle/build/docs/javadoc")
Expand All @@ -34,4 +58,26 @@ tasks {
build {
dependsOn(asciidoctor)
}

val prepareDocsForGitHubPages by registering(Copy::class) {
dependsOn(asciidoctor)
outputs.dir(docsDir)
from("$buildDir/docs") {
include("user-guide/**", "api/**")
}
into("$docsDir/$docsVersion")
includeEmptyDirs = false
}

val createCurrentDocsFolder by registering(Copy::class) {
dependsOn(prepareDocsForGitHubPages)
outputs.dir("$docsDir/current")
onlyIf { replaceCurrentDocs }
from("$docsDir/$docsVersion")
into("$docsDir/current")
}

gitPublishCommit {
dependsOn(prepareDocsForGitHubPages, createCurrentDocsFolder)
}
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pluginManagement {
id("com.diffplug.spotless") version "5.8.2"
id("com.gradle.plugin-publish") version "0.12.0"
id("org.asciidoctor.jvm.convert") version "3.3.0"
id("org.ajoberstar.git-publish") version "3.0.0"
}
}

Expand Down

0 comments on commit a5b4bb2

Please sign in to comment.