diff --git a/.github/workflows/site-gh-pages.yml b/.github/workflows/site-gh-pages.yml new file mode 100644 index 0000000..cbaa277 --- /dev/null +++ b/.github/workflows/site-gh-pages.yml @@ -0,0 +1,61 @@ +name: Deploy the site to GitHub Pages + +on: + push: + branches: [ "release" ] + pull_request: + branches: [ "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 11 + uses: actions/setup-java@v4 + with: + java-version: "11" + distribution: "temurin" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build the distribution with Gradle Wrapper + run: ./gradlew :generateSite + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build/site/ + + # 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 diff --git a/build.gradle.kts b/build.gradle.kts index 1241019..62db3b1 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,30 @@ +import org.jetbrains.dokka.gradle.tasks.DokkaGeneratePublicationTask + tasks.wrapper { distributionType = Wrapper.DistributionType.ALL } + +plugins { + id("org.jetbrains.dokka") +} + +dependencies { + listOf( + "compose-html-common", + "compose-html-material3" + ).forEach { + dokka(project(":$it")) + } +} + +val dokkaGeneratePublicationHtml by tasks.getting(DokkaGeneratePublicationTask::class) +tasks.register("generateSite") { + group = "site" + + val destRootDir = layout.buildDirectory.dir("site") + into(destRootDir) + from(dokkaGeneratePublicationHtml) { + into("api-documentation") + } + from(layout.projectDirectory.dir("site")) +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index a100bd9..2586469 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -17,4 +17,5 @@ dependencies { implementation("com.huanshankeji:kotlin-common-gradle-plugins:$huanshankejiGradlePluginsVersion") implementation("com.huanshankeji.team:gradle-plugins:$huanshankejiGradlePluginsVersion") implementation("com.huanshankeji:common-gradle-dependencies:0.8.0-20241016") // don't use a snapshot version in a main branch + implementation("org.jetbrains.dokka:dokka-gradle-plugin:2.0.0-Beta") } diff --git a/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts new file mode 100644 index 0000000..77fc338 --- /dev/null +++ b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts @@ -0,0 +1,12 @@ +plugins { + id("org.jetbrains.dokka") +} + +dokka { + dokkaSourceSets.all { + sourceLink { + remoteUrl("https://github.com/huanshankeji/compose-html-material/tree/v${version}/${project.name}") + remoteLineSuffix.set("#L") + } + } +} diff --git a/buildSrc/src/main/kotlin/lib-conventions.gradle.kts b/buildSrc/src/main/kotlin/lib-conventions.gradle.kts index e96eb9e..8d5bd06 100644 --- a/buildSrc/src/main/kotlin/lib-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/lib-conventions.gradle.kts @@ -1,4 +1,5 @@ plugins { id("lib-conventions-without-publishing") id("com.huanshankeji.kotlin-multiplatform-sonatype-ossrh-publish-conventions") -} \ No newline at end of file + id("dokka-convention") +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..4a50b9e --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +# for Dokka +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled diff --git a/settings.gradle.kts b/settings.gradle.kts index 9cedcae..799d5f2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,3 +5,11 @@ include("compose-html-material-legacy") include("compose-html-material3") include("gradle-plugins") project(":gradle-plugins").name = "compose-html-material-gradle-plugins-legacy" + +// for Dokka +@Suppress("UnstableApiUsage") +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..d9e1137 --- /dev/null +++ b/site/index.html @@ -0,0 +1,31 @@ + + + + + + + Compose HTML Material + + + + + + + + + \ No newline at end of file