Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create nice documentation and publish to GH pages #44

Merged
merged 10 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/gh-pages-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploy examples to GitHub Pages

on:
push:
branches:
- main

jobs:
build-web5-sdk-kotlin:
runs-on: ubuntu-latest
strategy:
matrix:
projects: [
web5-sdk-kotlin
]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v1
with:
java-version: 17
- uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
- name: Build html
run: ./gradlew dokkaHtmlMultiModule --no-daemon --stacktrace
working-directory: .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: docs
path: build/dokka

deploy-examples:
runs-on: ubuntu-latest
needs: [ build-web5-sdk-kotlin ]
steps:
- uses: actions/download-artifact@v2
with:
path: public
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
keep_files: true
publish_dir: ./public
full_commit_message: Publish documentation to GitHub pages
30 changes: 30 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import java.net.URL

plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.0"
id("java-library")
id("io.gitlab.arturbosch.detekt") version "1.23.1"
`maven-publish`
id("org.jetbrains.dokka") version "1.9.0"
}

repositories {
Expand All @@ -26,6 +30,7 @@ subprojects {
plugin("org.jetbrains.kotlin.jvm")
plugin("java-library")
plugin("maven-publish")
plugin("org.jetbrains.dokka")
}

tasks.withType<Detekt>().configureEach {
Expand Down Expand Up @@ -58,4 +63,29 @@ subprojects {
}
}
}

tasks.withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
documentedVisibilities.set(
setOf(
DokkaConfiguration.Visibility.PUBLIC,
DokkaConfiguration.Visibility.PROTECTED
)
)

sourceLink {
val exampleDir = "https://github.com/TBD54566975/web5-sdk-kotlin/tree/main"

localDirectory.set(rootProject.projectDir)
remoteUrl.set(URL(exampleDir))
remoteLineSuffix.set("#L")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have no idea, just copy pasted from the examples 🤷

}
}
}
}

// Configures only the parent MultiModule task,
// this will not affect subprojects
tasks.dokkaHtmlMultiModule {
moduleName.set("Web5 SDK Documentation")
}