Skip to content

Commit

Permalink
Merge pull request #15 from huanshankeji/dokka-github-pages-deployment
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 f8642e9 + c8f99f3 commit dc52fea
Show file tree
Hide file tree
Showing 6 changed files with 101 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: [ "plugins-release" ]
pull_request:
branches: [ "plugins-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: ubuntu-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: "temurin"

- 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
23 changes: 23 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,33 @@ tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}

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

// workaround for https://github.com/Kotlin/dokka/issues/3903 from https://github.com/Kotlin/dokka/issues/2260 TODO remove when it's fixed
repositories {
mavenCentral()
}

evaluationDependsOnChildren()
task("publishPluginProjectPlugins") {
group = "plugin portal"

val pluginProjects = subprojects.filter { it.name.endsWith("plugins") }
pluginProjects.forEach { dependsOn(it.tasks.named("publishPlugins")) }
}


dependencies {
/*
"common-gradle-dependencies" not added because it's published in a separate branch
"huanshankeji-team-gradle-plugins" not added because it's renamed and more cumbersome to configure, and also because it's only used by us
*/
listOf(
"kotlin-common-gradle-plugins",
"architecture-common-gradle-plugins",
).forEach {
dokka(project(":$it"))
}
}
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ dependencies {
// This is also a bootstrapping dependency.
implementation("com.huanshankeji:common-gradle-dependencies:0.7.1-20240314-boostrap") { exclude("org.jetbrains.kotlin") }
*/

implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0-Beta")
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
id("conventions")
id("dokka-convention")
}

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

dokka {
dokkaSourceSets.all {
sourceLink {
remoteUrl("https://github.com/huanshankeji/gradle-common/tree/v${version}/${project.name}")
remoteLineSuffix.set("#L")
}
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
#kotlin.mpp.stability.nowarn=true
# More memory is needed to build "architecture-common-gradle-plugins" since Kotlin 2.0.0
org.gradle.jvmargs=-Xmx2G
# for Dokka
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled

0 comments on commit dc52fea

Please sign in to comment.