Skip to content

Commit 0575a68

Browse files
committed
Automated publication of documentation
Now, when pushing to the release branch, all documentation will be automatically collected in one place and dokka documentation will be automatically generated. After that, it will be published on the GitHub pages
1 parent e80c83c commit 0575a68

File tree

14 files changed

+110
-8
lines changed

14 files changed

+110
-8
lines changed

Diff for: .github/workflows/docs.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Deploy Kover Docs
2+
3+
on:
4+
# Runs on pushes targeting the release branch
5+
push:
6+
branches: ["release"]
7+
8+
# Allows you to run this workflow manually from the Actions tab
9+
workflow_dispatch:
10+
11+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
18+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
19+
concurrency:
20+
group: "pages"
21+
cancel-in-progress: false
22+
23+
jobs:
24+
# Docs build job
25+
build:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout Kover
29+
uses: actions/checkout@v4
30+
- name: Install Java
31+
uses: actions/setup-java@v4
32+
with:
33+
distribution: 'zulu'
34+
java-version: 17
35+
cache: 'gradle'
36+
- name: Install Gradle
37+
uses: gradle/gradle-build-action@v2
38+
with:
39+
gradle-home-cache-cleanup: true
40+
- name: Prepare Kover docs sources
41+
run: ./gradlew releaseDocs
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Build with Jekyll
45+
uses: actions/jekyll-build-pages@v1
46+
with:
47+
source: docs
48+
destination: ./_site
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v3
51+
52+
# Deployment job
53+
deploy:
54+
environment:
55+
name: github-pages
56+
url: ${{ steps.deployment.outputs.page_url }}
57+
runs-on: ubuntu-latest
58+
needs: build
59+
steps:
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v4

Diff for: docs/_config.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
remote_theme: pages-themes/[email protected]
2+
plugins:
3+
- jekyll-remote-theme # add this line to the plugins list if you already have one
24
lsi: false
35
safe: true
4-
source: /
56
highlighter: rouge
67
incremental: false
78
gist:

Diff for: docs/index.md

-3
This file was deleted.

Diff for: kover-cli/build.gradle.kts

+14
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,17 @@ tasks.jar {
6363
repositories {
6464
mavenCentral()
6565
}
66+
67+
tasks.register("releaseDocs") {
68+
val dirName = "cli"
69+
val description = "Kover Command Line Interface"
70+
val sourceDir = projectDir.resolve("docs")
71+
val resultDir = rootDir.resolve("docs/$dirName")
72+
val mainIndexFile = rootDir.resolve("docs/index.md")
73+
74+
doLast {
75+
resultDir.mkdirs()
76+
sourceDir.copyRecursively(resultDir)
77+
mainIndexFile.appendText("- [$description]($dirName)\n")
78+
}
79+
}
File renamed without changes.

Diff for: kover-gradle-plugin/build.gradle.kts

+18-4
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,9 @@ afterEvaluate {
146146

147147
tasks.dokkaHtml {
148148
moduleName.set("Kover Gradle Plugin")
149-
outputDirectory.set(rootProject.layout.projectDirectory.dir("docs/gradle-plugin/dokka").asFile)
149+
outputDirectory.set(projectDir.resolve("docs/dokka"))
150150

151-
if (project.hasProperty("releaseVersion")) {
152-
moduleVersion.set(project.property("releaseVersion") as String)
153-
}
151+
moduleVersion.set(project.property("kover.release.version").toString())
154152

155153
dokkaSourceSets.configureEach {
156154
// source set configuration section
@@ -165,6 +163,22 @@ tasks.dokkaHtml {
165163
}
166164
}
167165

166+
tasks.register("releaseDocs") {
167+
val dirName = "gradle-plugin"
168+
val description = "Kover Gradle Plugin"
169+
val sourceDir = projectDir.resolve("docs")
170+
val resultDir = rootDir.resolve("docs/$dirName")
171+
val mainIndexFile = rootDir.resolve("docs/index.md")
172+
173+
dependsOn(tasks.dokkaHtml)
174+
175+
doLast {
176+
resultDir.mkdirs()
177+
sourceDir.copyRecursively(resultDir)
178+
mainIndexFile.appendText("- [$description]($dirName)\n")
179+
}
180+
}
181+
168182
extensions.configure<Kover_publishing_conventions_gradle.KoverPublicationExtension> {
169183
description.set("Kover Gradle Plugin - Kotlin code coverage")
170184
//`java-gradle-plugin` plugin already creates publication with name `pluginMaven`
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: kover-offline-runtime/build.gradle.kts

+14
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,17 @@ tasks.jar {
5151
exclude("classpath.index")
5252
}
5353
}
54+
55+
tasks.register("releaseDocs") {
56+
val dirName = "offline-instrumentation"
57+
val description = "Kover offline instrumentation"
58+
val sourceDir = projectDir.resolve("docs")
59+
val resultDir = rootDir.resolve("docs/$dirName")
60+
val mainIndexFile = rootDir.resolve("docs/index.md")
61+
62+
doLast {
63+
resultDir.mkdirs()
64+
sourceDir.copyRecursively(resultDir)
65+
mainIndexFile.appendText("- [$description]($dirName)\n")
66+
}
67+
}
File renamed without changes.

0 commit comments

Comments
 (0)