Skip to content

Commit 6b288bc

Browse files
stevenzeckmickael-menu
authored andcommitted
Use Dokka and Mkdocs to generate documentation (#19)
1 parent b33a5dd commit 6b288bc

File tree

5 files changed

+142
-0
lines changed

5 files changed

+142
-0
lines changed

.github/workflows/docs.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Documentation
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
docs:
11+
name: Update documentation
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Fetch tags
19+
run: git fetch --prune --unshallow
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.6
25+
26+
- name: Install Python dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install mkdocs mkdocs-material mike
30+
31+
- uses: actions/setup-java@v2
32+
with:
33+
java-version: 11
34+
distribution: 'adopt'
35+
36+
- name: Get current Readium version
37+
run: echo "READIUM_VERSION=`git describe --tag --match [0-9]* --abbrev=0`" >> $GITHUB_ENV
38+
39+
- name: Run Dokka
40+
run: ./gradlew dokkaGfmMultiModule
41+
42+
- name: Run MkDocs
43+
run: |
44+
git config --global user.name "${GITHUB_ACTOR}"
45+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
46+
mike deploy ${{ env.READIUM_VERSION }}
47+
mike set-default ${{ env.READIUM_VERSION }}
48+
mike deploy --rebase --push --update-aliases ${{ env.READIUM_VERSION }} latest

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,6 @@ lint/reports/
7373

7474
# Android Profiling
7575
*.hprof
76+
77+
# Docs
78+
docs/readium

build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
buildscript {
88
ext.kotlin_version = '1.5.31'
9+
ext.dokka_version = '1.5.30'
910

1011
repositories {
1112
google()
@@ -18,9 +19,12 @@ buildscript {
1819
dependencies {
1920
classpath 'com.android.tools.build:gradle:7.0.2'
2021
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
22+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
2123
}
2224
}
2325

26+
apply plugin: 'org.jetbrains.dokka'
27+
2428
allprojects {
2529
repositories {
2630
google()
@@ -32,6 +36,28 @@ allprojects {
3236
}
3337
}
3438

39+
subprojects { project ->
40+
if (project.name == 'test-app' || project.name == 'readium') return
41+
apply plugin: 'org.jetbrains.dokka'
42+
tasks.named("dokkaGfmPartial") {
43+
dokkaSourceSets {
44+
configureEach {
45+
reportUndocumented.set(false)
46+
skipEmptyPackages.set(false)
47+
skipDeprecated.set(true)
48+
}
49+
}
50+
}
51+
}
52+
3553
task clean(type: Delete) {
3654
delete rootProject.buildDir
3755
}
56+
57+
task cleanDocs(type: Delete) {
58+
delete "${project.rootDir}/docs/readium", "${project.rootDir}/docs/index.md"
59+
}
60+
61+
tasks.dokkaGfmMultiModule.configure {
62+
outputDirectory = new File("${project.rootDir}/docs")
63+
}

docs/readium_colors.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
body {
2+
--md-primary-fg-color: #449d44;
3+
--md-primary-fg-color--light: #73b02c;
4+
--md-primary-fg-color--dark: #255625;
5+
--md-accent-fg-color: #73b02c;
6+
}

mkdocs.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
site_name: Readium Kotlin
2+
3+
# Meta tags (placed in header)
4+
site_description: Readium Mobile is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin.
5+
site_author: Readium Foundation
6+
site_url: https://github.com/readium/kotlin-toolkit
7+
8+
# Repository (add link to repository on each page)
9+
repo_name: kotlin-toolkit
10+
repo_url: https://github.com/readium/kotlin-toolkit
11+
12+
# Copyright (shown at the footer)
13+
copyright: 'Copyright © 2021 Readium Foundation'
14+
15+
# Material theme
16+
theme:
17+
name: 'material'
18+
# favicon: favicon.svg
19+
social:
20+
- type: 'github'
21+
link: 'https://github.com/readium/kotlin-toolkit'
22+
23+
# Extensions
24+
markdown_extensions:
25+
- admonition
26+
- codehilite:
27+
guess_lang: false
28+
- footnotes
29+
- meta
30+
- def_list
31+
- toc:
32+
permalink: true
33+
# - pymdownx.betterem:
34+
# smart_enable: all
35+
# - pymdownx.caret
36+
# - pymdownx.inlinehilite
37+
# - pymdownx.magiclink
38+
# - pymdownx.smartsymbols
39+
# - pymdownx.superfences
40+
41+
# Dev server binding
42+
#dev_addr: 127.0.0.1:3001
43+
44+
nav:
45+
- Migration Guide: migration-guide.md
46+
- API Reference:
47+
- Shared: readium/shared/index.md
48+
- Streamer: readium/streamer/index.md
49+
- Navigator: readium/navigator/index.md
50+
- OPDS: readium/opds/index.md
51+
- LCP: readium/lcp/index.md
52+
53+
extra_css:
54+
- readium_colors.css
55+
56+
extra:
57+
version:
58+
provider: mike
59+

0 commit comments

Comments
 (0)