Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 13 additions & 37 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy to GitHub Pages
# Workflow for building and deploying Dokka documentation to GitHub Pages
name: Deploy Dokka Docs to GitHub Pages

on:
# Runs on pushes targeting the default branch
Expand All @@ -16,60 +16,36 @@ permissions:
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

env:
JEKYLL_OUTPUT_DIR: ./dist
DOKKA_ARTIFACT_NAME: dokka-html

jobs:
api-docs:
name: Generate Dokka HTML docs
# Build and upload the Dokka documentation
build-and-upload:
name: Generate and Upload Dokka Docs
runs-on: macos-latest # For Kotlin/Native
steps:
- name: Checkout
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17

- name: Generate Dokka HTML docs
run: ./gradlew :dokkaHtml
- name: Upload Dokka output
uses: actions/upload-artifact@v4
with:
name: ${{ env.DOKKA_ARTIFACT_NAME }}
path: build/dokka/html
if-no-files-found: error
# Build job
build:
name: Build Jekyll docs
runs-on: ubuntu-latest
needs: api-docs
steps:
# Workaround for https://github.com/actions/jekyll-build-pages/issues/101
- name: Create output directory
run: mkdir ${{ env.JEKYLL_OUTPUT_DIR }}

- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ${{ env.JEKYLL_OUTPUT_DIR }}
- name: Download Dokka artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.DOKKA_ARTIFACT_NAME }}
path: ${{ env.JEKYLL_OUTPUT_DIR }}/api

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.JEKYLL_OUTPUT_DIR }}
# Upload the generated Dokka HTML directory
path: build/dokka/html

# Deployment job
deploy:
Expand All @@ -78,7 +54,7 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
needs: build-and-upload # Wait for the build job to finish
steps:
- name: Deploy to GitHub Pages
id: deployment
Expand Down
35 changes: 27 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// File: build.gradle.kts
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.jvm.tasks.Jar
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
Expand Down Expand Up @@ -285,13 +287,7 @@ tasks {

// Docs

tasks {
register<Jar>("dokkaJar") {
from(dokkaHtml)
dependsOn(dokkaHtml)
archiveClassifier.set("javadoc")
}
}



// Tests
Expand Down Expand Up @@ -357,7 +353,7 @@ publishing {
url.set("https://github.com/oshai/kotlin-logging/tree/master")
}
}
artifact(tasks["dokkaJar"])

}
}

Expand Down Expand Up @@ -385,4 +381,27 @@ tasks.withType<AbstractPublishToMaven>().configureEach {
val signingTasks = tasks.withType<Sign>()
mustRunAfter(signingTasks)
}
tasks.withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
// We want to see all declarations, even if they are not explicitly documented.
reportUndocumented.set(true)
}
}

val dokkaHtmlPublication by tasks.creating(DokkaTask::class) {
outputDirectory.set(buildDir.resolve("dokka/html"))
}

val javadocJar by tasks.register<Jar>("javadocJar") {
dependsOn(dokkaHtmlPublication)
from(dokkaHtmlPublication.outputDirectory)
archiveClassifier.set("javadoc")
}

publishing {
publications.withType<MavenPublication> {
artifact(javadocJar)
}
}

//endregion
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ org.gradle.jvmargs=-Xmx2048m
# see https://kotlinlang.org/docs/whatsnew18.html#sourcedirectories
kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.mpp.applyDefaultHierarchyTemplate=false
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
Loading