From a01b55e62ad9857a493b50d8f330d6fa8fd4aa6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Kozak?= Date: Mon, 10 Aug 2026 11:07:24 +0200 Subject: [PATCH] Generate and publish KDoc/API docs via Dokka + GitHub Pages Aggregates KDoc from core and plugin into a single Dokka HTML site, built and deployed to GitHub Pages on every push to master. Also lets core's javadoc jar be auto-derived from Dokka instead of staying empty. --- .github/workflows/docs.yml | 48 ++++++++++++++++++++++++++++++++++++++ README.md | 2 ++ build.gradle.kts | 15 ++++++++++++ core/build.gradle.kts | 13 +++++++++++ plugin/build.gradle.kts | 13 +++++++++++ 5 files changed, 91 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..3d60578a --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,48 @@ +name: Docs + +on: + push: + branches: [ master ] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + + - uses: gradle/actions/setup-gradle@v4 + + - name: Generate API docs + run: ./gradlew :dokkaGenerate + + - uses: actions/upload-pages-artifact@v3 + with: + path: build/dokka + + deploy: + needs: build + runs-on: ubuntu-latest + + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - id: deployment + uses: actions/deploy-pages@v4 diff --git a/README.md b/README.md index fd51463f..dae1ff28 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ A Gradle plugin that generates type-safe Kotlin [Ktor](https://ktor.io/) client code from OpenAPI 3.0 specifications. +API documentation: https://avsystem.github.io/justworks/ + ## Installation Add the plugin to your `build.gradle.kts`: diff --git a/build.gradle.kts b/build.gradle.kts index 3dd8b0ec..16df4513 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,6 +5,7 @@ plugins { id("org.jlleitschuh.gradle.ktlint") version "14.2.0" apply false id("org.jetbrains.kotlinx.kover") version "0.9.9" apply false id("com.vanniktech.maven.publish") version "0.37.0" apply false + id("org.jetbrains.dokka") version "2.2.0" } allprojects { @@ -63,3 +64,17 @@ subprojects { } } } + +dependencies { + dokka(project(":core")) + dokka(project(":plugin")) +} + +dokka { + moduleName.set("justworks") + + dokkaPublications.html { + outputDirectory.set(layout.buildDirectory.dir("dokka")) + includes.from("README.md") + } +} diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 8e1ef4d4..ebde82db 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -4,12 +4,25 @@ plugins { kotlin("jvm") id("org.jetbrains.kotlinx.kover") id("com.vanniktech.maven.publish") + id("org.jetbrains.dokka") version "2.2.0" } kotlin { jvmToolchain(21) } +dokka { + moduleName.set("justworks-core") + + dokkaSourceSets.main { + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://github.com/AVSystem/justworks/tree/master/core/src/main/kotlin") + remoteLineSuffix.set("#L") + } + } +} + // todo: remove when https://github.com/JLLeitschuh/ktlint-gradle/issues/912 resolved ktlint { version = "1.8.0" diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 6119aac0..431d47f7 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -6,12 +6,25 @@ plugins { `java-gradle-plugin` id("com.vanniktech.maven.publish") id("org.jetbrains.kotlinx.kover") + id("org.jetbrains.dokka") version "2.2.0" } kotlin { jvmToolchain(21) } +dokka { + moduleName.set("justworks-plugin") + + dokkaSourceSets.main { + sourceLink { + localDirectory.set(file("src/main/kotlin")) + remoteUrl("https://github.com/AVSystem/justworks/tree/master/plugin/src/main/kotlin") + remoteLineSuffix.set("#L") + } + } +} + dependencies { implementation(project(":core")) testImplementation(kotlin("test"))