ci: add Dokka for kdoc documentation generation and deployment (#3024)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich
2025-09-08 18:31:53 -05:00
committed by GitHub
parent bd29d0c55c
commit e490b036be
6 changed files with 90 additions and 0 deletions

63
.github/workflows/docs.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
# This workflow builds and deploys the Dokka documentation to GitHub Pages.
name: Deploy Documentation
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# 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-docs:
if: github.repository == 'meshtastic/Meshtastic-Android'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'jetbrains'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build Dokka HTML documentation
run: ./gradlew :app:dokkaHtml
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: app/build/dokka
deploy:
if: github.repository == 'meshtastic/Meshtastic-Android'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build-docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View File

@@ -38,6 +38,23 @@ width="24%">](https://play.google.com/store/apps/details?id=com.geeksville.mesh&
The play store is the last to update of these options, but if you want to join the Play Store testing program go to [this URL](https://play.google.com/apps/testing/com.geeksville.mesh) and opt-in to become a tester.
If you encounter any problems or have questions, [ask us on the discord](https://discord.gg/meshtastic), [create an issue](https://github.com/meshtastic/Meshtastic-Android/issues), or [post in the forum](https://github.com/orgs/meshtastic/discussions) and we'll help as we can.
## Documentation
The project's documentation is generated with [Dokka](https://kotlinlang.org/docs/dokka-introduction.html) and hosted on GitHub Pages. It is automatically updated on every push to the `main` branch.
[**View Documentation**](https://meshtastic.github.io/Meshtastic-Android/)
### Generating Locally
You can generate the documentation locally to preview your changes.
1. **Run the Dokka task:**
```bash
./gradlew :app:dokkaHtml
```
2. **View the output:**
The generated HTML files will be located in the `app/build/dokka/html` directory. You can open the `index.html` file in your browser to view the documentation.
## Translations
You can help translate the app into your native language using [Crowdin](https://crowdin.meshtastic.org/android).

View File

@@ -32,6 +32,7 @@ plugins {
alias(libs.plugins.datadog)
alias(libs.plugins.secrets)
alias(libs.plugins.spotless)
alias(libs.plugins.dokka)
}
val keystorePropertiesFile = rootProject.file("keystore.properties")
@@ -348,3 +349,8 @@ spotless {
ktlint("1.7.1").setEditorConfigPath("../config/spotless/.editorconfig")
}
}
tasks.withType<org.jetbrains.dokka.gradle.DokkaTask>().configureEach {
moduleName.set("Meshtastic App")
outputDirectory.set(file("build/dokka"))
}

View File

@@ -30,6 +30,7 @@ plugins {
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.protobuf) apply false
alias(libs.plugins.secrets) apply false
alias(libs.plugins.dokka) apply false
}
tasks.register<Delete>("clean") {

View File

@@ -55,6 +55,7 @@ work-runtime-ktx = "2.10.3"
zxing-android-embedded = "4.3.0"
zxing-core = "3.5.3"
spotless = "7.2.1"
dokka = "2.0.0"
[libraries]
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanistPermissions" }
@@ -217,6 +218,7 @@ android-library = { id = "com.android.library", version.ref = "agp" }
compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
datadog = { id = "com.datadoghq.dd-sdk-android-gradle-plugin", version.ref = "dd-sdk-android-gradle-plugin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "devtools-ksp" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics" , version.ref = "crashlytics" }
google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }

View File

@@ -24,6 +24,7 @@ plugins {
alias(libs.plugins.devtools.ksp)
alias(libs.plugins.detekt)
id("kotlinx-serialization")
alias(libs.plugins.dokka)
}
android {