Skip to content

Commit

Permalink
Automated publication of documentation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
shanshin committed Feb 17, 2024
1 parent e80c83c commit 0575a68
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 8 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Deploy Kover Docs

on:
# Runs on pushes targeting the release branch
push:
branches: ["release"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Docs build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Kover
uses: actions/checkout@v4
- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
cache: 'gradle'
- name: Install Gradle
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Prepare Kover docs sources
run: ./gradlew releaseDocs
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: docs
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
remote_theme: pages-themes/[email protected]
plugins:
- jekyll-remote-theme # add this line to the plugins list if you already have one
lsi: false
safe: true
source: /
highlighter: rouge
incremental: false
gist:
Expand Down
3 changes: 0 additions & 3 deletions docs/index.md

This file was deleted.

14 changes: 14 additions & 0 deletions kover-cli/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ tasks.jar {
repositories {
mavenCentral()
}

tasks.register("releaseDocs") {
val dirName = "cli"
val description = "Kover Command Line Interface"
val sourceDir = projectDir.resolve("docs")
val resultDir = rootDir.resolve("docs/$dirName")
val mainIndexFile = rootDir.resolve("docs/index.md")

doLast {
resultDir.mkdirs()
sourceDir.copyRecursively(resultDir)
mainIndexFile.appendText("- [$description]($dirName)\n")
}
}
File renamed without changes.
22 changes: 18 additions & 4 deletions kover-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,9 @@ afterEvaluate {

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

if (project.hasProperty("releaseVersion")) {
moduleVersion.set(project.property("releaseVersion") as String)
}
moduleVersion.set(project.property("kover.release.version").toString())

dokkaSourceSets.configureEach {
// source set configuration section
Expand All @@ -165,6 +163,22 @@ tasks.dokkaHtml {
}
}

tasks.register("releaseDocs") {
val dirName = "gradle-plugin"
val description = "Kover Gradle Plugin"
val sourceDir = projectDir.resolve("docs")
val resultDir = rootDir.resolve("docs/$dirName")
val mainIndexFile = rootDir.resolve("docs/index.md")

dependsOn(tasks.dokkaHtml)

doLast {
resultDir.mkdirs()
sourceDir.copyRecursively(resultDir)
mainIndexFile.appendText("- [$description]($dirName)\n")
}
}

extensions.configure<Kover_publishing_conventions_gradle.KoverPublicationExtension> {
description.set("Kover Gradle Plugin - Kotlin code coverage")
//`java-gradle-plugin` plugin already creates publication with name `pluginMaven`
Expand Down
File renamed without changes.
File renamed without changes
File renamed without changes.
14 changes: 14 additions & 0 deletions kover-offline-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,17 @@ tasks.jar {
exclude("classpath.index")
}
}

tasks.register("releaseDocs") {
val dirName = "offline-instrumentation"
val description = "Kover offline instrumentation"
val sourceDir = projectDir.resolve("docs")
val resultDir = rootDir.resolve("docs/$dirName")
val mainIndexFile = rootDir.resolve("docs/index.md")

doLast {
resultDir.mkdirs()
sourceDir.copyRecursively(resultDir)
mainIndexFile.appendText("- [$description]($dirName)\n")
}
}
File renamed without changes.

0 comments on commit 0575a68

Please sign in to comment.