-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# This workflow will upload docs to the gh-pages branch whenever something is pushed to master. | ||
|
||
name: Docs | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
upload_docs: | ||
name: upload docs | ||
runs-on: ubuntu-latest | ||
env: | ||
GRGIT_USER: ${{ secrets.GRGIT_USER }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 1.14 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.14 | ||
|
||
- name: Publish docs with Gradle | ||
run: gradle --stacktrace --info gitPublishPush |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
.idea/ | ||
build/ | ||
out/ | ||
dokka/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.TaskAction | ||
import java.nio.file.Files | ||
import java.nio.file.Paths | ||
import java.nio.file.StandardOpenOption | ||
|
||
open class DocsTask : DefaultTask() { | ||
|
||
@TaskAction | ||
fun publish() { | ||
val dokkaRoot = Paths.get(project.projectDir.absolutePath, "dokka") | ||
|
||
val index = Paths.get(dokkaRoot.toAbsolutePath().toString(), "kord", "index.html") | ||
val newIndex = Paths.get(dokkaRoot.toAbsolutePath().toString(), "index.html") | ||
|
||
//We're technically not moving the index.html. Instead, a working copy will be brought over to the root directory. | ||
//This is a bit of a MacGyver move, but it's the easiest solution I could think of. | ||
Files.createFile(newIndex) | ||
|
||
var reachedPackages = false | ||
//the default index.html is nested inside a folder, we'll move all links up by one directory to fix this in the | ||
//root index.html copy. | ||
Files.lines(index).map { it.replace("""../""", "") }.forEach { | ||
var line = it | ||
if ( it.contains("packages", true)) { | ||
reachedPackages = true | ||
} | ||
|
||
if (reachedPackages){ | ||
//once we reach the packages declaration, we'll have to do a similar thing as above | ||
//we'll move all package links down into the kord directory. | ||
line = line.replace("""href="""", """href="kord/""") | ||
} | ||
|
||
Files.write(newIndex, (line + "\n").toByteArray(Charsets.UTF_8), StandardOpenOption.APPEND) | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters