diff --git a/.github/workflows/gh-pages-deploy.yml b/.github/workflows/gh-pages-deploy.yml new file mode 100644 index 000000000..49a7a1819 --- /dev/null +++ b/.github/workflows/gh-pages-deploy.yml @@ -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 \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 0309967b2..e7e0da3f0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 { @@ -26,6 +30,7 @@ subprojects { plugin("org.jetbrains.kotlin.jvm") plugin("java-library") plugin("maven-publish") + plugin("org.jetbrains.dokka") } tasks.withType().configureEach { @@ -58,4 +63,29 @@ subprojects { } } } + + tasks.withType().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") + } + } + } +} + +// Configures only the parent MultiModule task, +// this will not affect subprojects +tasks.dokkaHtmlMultiModule { + moduleName.set("Web5 SDK Documentation") } \ No newline at end of file