Skip to content

Commit

Permalink
Merge pull request #12 from huanshankeji/dokka
Browse files Browse the repository at this point in the history
Deploy the API documentation to GitHub Pages with Dokka
  • Loading branch information
ShreckYe authored Nov 5, 2024
2 parents 1f6c6db + 101bc0c commit 59a41c0
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/dokka-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy the API documentation to GitHub Pages with Dokka

on:
push:
branches: [ "release" ]
pull_request:
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:
# Build job
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Set up JDK 8
uses: actions/setup-java@v4
with:
java-version: "8"
distribution: "zulu"

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Build the distribution with Gradle Wrapper
run: ./gradlew :dokkaGeneratePublicationHtml

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: build/dokka/html/

# 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
25 changes: 25 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
import com.huanshankeji.cpnProject

tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}

plugins {
id("org.jetbrains.dokka")
}

dependencies {
listOf(
"core",
"net",
"web",

"arrow",
"coroutines",
"exposed",
"ktor:client",
"reflect",
"serialization",
"vertx",
"vertx:with-context-receivers",
).forEach {
dokka(cpnProject(project, ":$it"))
}
}
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ dependencies {
implementation(kotlin("gradle-plugin", "2.0.10"))
implementation("com.huanshankeji:common-gradle-dependencies:0.8.0-20241016") // don't use a snapshot version in a main branch
implementation("com.huanshankeji.team:gradle-plugins:0.6.0") // don't use a snapshot version in a main branch
implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0-Beta")
}
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/common-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id("com.huanshankeji.team.with-group")
id("maven-central")
id("com.huanshankeji.team.default-github-packages-maven-publish")
id("dokka-convention")
}

version = projectVersion
Expand Down
24 changes: 24 additions & 0 deletions buildSrc/src/main/kotlin/dokka-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
plugins {
id("org.jetbrains.dokka")
}

dokka {
//moduleName.set("Huanshankeji Kotlin Common")
dokkaSourceSets.all {
//includes.from("README.md")
sourceLink {
//localDirectory.set(file("src/main/kotlin"))
remoteUrl(
"https://github.com/huanshankeji/kotlin-common/tree/v${version}/${
with(project) {
name.removePrefix(parent!!.name + '-')
}
}"
)
remoteLineSuffix.set("#L")
}
/*pluginsConfiguration.html {
footerMessage.set("(c) Yongshun Ye")
}*/
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
kotlin.mpp.stability.nowarn=true
# needed for the GitHub Actions CI
org.gradle.jvmargs=-Xmx4G
# for Dokka
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

0 comments on commit 59a41c0

Please sign in to comment.