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

Deploy the site to GitHub Pages #8

Merged
merged 4 commits into from
Nov 6, 2024
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
61 changes: 61 additions & 0 deletions .github/workflows/site-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<Sync>("generateSite") {
group = "site"

val destRootDir = layout.buildDirectory.dir("site")
into(destRootDir)
from(dokkaGeneratePublicationHtml) {
into("api-documentation")
}
from(layout.projectDirectory.dir("site"))
}
1 change: 1 addition & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/dokka-convention.gradle.kts
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/lib-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
plugins {
id("lib-conventions-without-publishing")
id("com.huanshankeji.kotlin-multiplatform-sonatype-ossrh-publish-conventions")
}
id("dokka-convention")
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# for Dokka
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
8 changes: 8 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
31 changes: 31 additions & 0 deletions site/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta charset="UTF-8">
<title>Compose HTML Material</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<style>
body {
margin: 0;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
</style>
</head>

<body>
<ul>
<li><a href="api-documentation/index.html">API documentation</a></li>
<li>
<a href="https://huanshankeji.github.io/compose-multiplatform-material/">
Compose Multiplatform Material side-by-side demo
</a>
</li>
</ul>
</body>

</html>
Loading