diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..3d60578 --- /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 fd51463..dae1ff2 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 3dd8b0e..16df451 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 8e1ef4d..ebde82d 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 6119aac..431d47f 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"))