|
5 | 5 | @file:Repository("https://bindings.krzeminski.it") |
6 | 6 | @file:DependsOn("actions:checkout:v4") |
7 | 7 | @file:DependsOn("gradle:actions__setup-gradle:v3") |
| 8 | +@file:DependsOn("JamesIves:github-pages-deploy-action:v4") |
8 | 9 |
|
9 | 10 | @file:Import("_shared.main.kts") |
10 | | -@file:Import("release-common.main.kts") |
11 | 11 | @file:Import("setup-java.main.kts") |
12 | 12 | @file:Import("setup-python.main.kts") |
13 | 13 |
|
14 | 14 | import io.github.typesafegithub.workflows.actions.actions.Checkout |
15 | 15 | import io.github.typesafegithub.workflows.actions.gradle.ActionsSetupGradle |
| 16 | +import io.github.typesafegithub.workflows.actions.jamesives.GithubPagesDeployAction |
16 | 17 | import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest |
17 | 18 | import io.github.typesafegithub.workflows.domain.triggers.Push |
| 19 | +import io.github.typesafegithub.workflows.dsl.JobBuilder |
18 | 20 | import io.github.typesafegithub.workflows.dsl.expressions.expr |
19 | 21 | import io.github.typesafegithub.workflows.dsl.workflow |
20 | 22 |
|
@@ -62,3 +64,36 @@ workflow( |
62 | 64 | deployDocs() |
63 | 65 | } |
64 | 66 | } |
| 67 | + |
| 68 | +private fun JobBuilder<*>.deployDocs() { |
| 69 | + run(command = "pip install -r docs/requirements.txt") |
| 70 | + |
| 71 | + val directoryToDeploy = "to-gh-pages" |
| 72 | + run( |
| 73 | + name = "Build Mkdocs docs", |
| 74 | + command = "mkdocs build --site-dir $directoryToDeploy", |
| 75 | + ) |
| 76 | + uses(action = ActionsSetupGradle()) |
| 77 | + run( |
| 78 | + name = "Generate API docs", |
| 79 | + command = "./gradlew :github-workflows-kt:dokkaHtml --no-configuration-cache", |
| 80 | + ) |
| 81 | + run( |
| 82 | + name = "Prepare target directory for API docs", |
| 83 | + command = "mkdir -p $directoryToDeploy/api-docs", |
| 84 | + ) |
| 85 | + run( |
| 86 | + name = "Copy Dokka output to Mkdocs output", |
| 87 | + command = "cp -r github-workflows-kt/build/dokka/html/* $directoryToDeploy/api-docs", |
| 88 | + ) |
| 89 | + run( |
| 90 | + name = "Copy teaser image", |
| 91 | + command = "cp images/teaser-with-newest-version.svg $directoryToDeploy" |
| 92 | + ) |
| 93 | + uses( |
| 94 | + name = "Deploy merged docs to GitHub Pages", |
| 95 | + action = GithubPagesDeployAction( |
| 96 | + folder = "$directoryToDeploy", |
| 97 | + ), |
| 98 | + ) |
| 99 | +} |
0 commit comments