Skip to content

Commit d2ee3ed

Browse files
committed
Configure the Dokka Gradle plugin, its tasks, and the GitHub Actions workflow, with code copied and adapted from "gradle-common"
A source commit: huanshankeji/gradle-common@d0c8105
1 parent 7fbfdbb commit d2ee3ed

File tree

6 files changed

+96
-1
lines changed

6 files changed

+96
-1
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy the API documentation to GitHub Pages with Dokka
2+
3+
on:
4+
push:
5+
branches: [ "release" ]
6+
pull_request:
7+
branches: [ "release" ]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Build job
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
- name: Setup Pages
32+
uses: actions/configure-pages@v5
33+
34+
- name: Set up JDK 11
35+
uses: actions/setup-java@v4
36+
with:
37+
java-version: "11"
38+
distribution: "temurin"
39+
40+
- name: Setup Gradle
41+
uses: gradle/actions/setup-gradle@v4
42+
43+
- name: Build the distribution with Gradle Wrapper
44+
run: ./gradlew :dokkaGeneratePublicationHtml
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: build/dokka/html/
50+
51+
# Deployment job
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
runs-on: ubuntu-latest
57+
needs: build
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

build.gradle.kts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
11
tasks.wrapper {
22
distributionType = Wrapper.DistributionType.ALL
33
}
4+
5+
plugins {
6+
id("org.jetbrains.dokka")
7+
}
8+
9+
// workaround for https://github.com/Kotlin/dokka/issues/3903 from https://github.com/Kotlin/dokka/issues/2260 TODO remove when it's fixed
10+
repositories {
11+
mavenCentral()
12+
}
13+
14+
dependencies {
15+
listOf(
16+
"compose-html-common",
17+
"compose-html-material3"
18+
).forEach {
19+
dokka(project(":$it"))
20+
}
21+
}

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ dependencies {
1717
implementation("com.huanshankeji:kotlin-common-gradle-plugins:$huanshankejiGradlePluginsVersion")
1818
implementation("com.huanshankeji.team:gradle-plugins:$huanshankejiGradlePluginsVersion")
1919
implementation("com.huanshankeji:common-gradle-dependencies:0.8.0-20241016") // don't use a snapshot version in a main branch
20+
implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0-Beta")
2021
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
plugins {
2+
id("org.jetbrains.dokka")
3+
}
4+
5+
dokka {
6+
dokkaSourceSets.all {
7+
sourceLink {
8+
remoteUrl("https://github.com/huanshankeji/compose-html-material/tree/v${version}/${project.name}")
9+
remoteLineSuffix.set("#L")
10+
}
11+
}
12+
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
plugins {
22
id("lib-conventions-without-publishing")
33
id("com.huanshankeji.kotlin-multiplatform-sonatype-ossrh-publish-conventions")
4-
}
4+
id("dokka-convention")
5+
}

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# for Dokka
2+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

0 commit comments

Comments
 (0)