diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..adda6d76 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,62 @@ +name: Deploy Kover Docs + +on: + # Runs on pushes targeting the release branch + push: + 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: + # Docs build job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Kover + uses: actions/checkout@v4 + - name: Install Java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 17 + cache: 'gradle' + - name: Install Gradle + uses: gradle/gradle-build-action@v2 + with: + gradle-home-cache-cleanup: true + - name: Prepare Kover docs sources + run: ./gradlew releaseDocs + - name: Setup Pages + uses: actions/configure-pages@v4 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: docs + destination: ./_site + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # 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/docs/_config.yml b/docs/_config.yml index 6ebdc811..f473ec69 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,7 +1,8 @@ remote_theme: pages-themes/slate@v0.2.0 +plugins: + - jekyll-remote-theme # add this line to the plugins list if you already have one lsi: false safe: true -source: / highlighter: rouge incremental: false gist: diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 70e8cbec..00000000 --- a/docs/index.md +++ /dev/null @@ -1,3 +0,0 @@ -- [Kover Gradle Plugin](gradle-plugin) -- [Kover Command Line Interface](cli) -- [Kover offline instrumentation](offline-instrumentation) \ No newline at end of file diff --git a/kover-cli/build.gradle.kts b/kover-cli/build.gradle.kts index cf245634..189c53dc 100644 --- a/kover-cli/build.gradle.kts +++ b/kover-cli/build.gradle.kts @@ -63,3 +63,17 @@ tasks.jar { repositories { mavenCentral() } + +tasks.register("releaseDocs") { + val dirName = "cli" + val description = "Kover Command Line Interface" + val sourceDir = projectDir.resolve("docs") + val resultDir = rootDir.resolve("docs/$dirName") + val mainIndexFile = rootDir.resolve("docs/index.md") + + doLast { + resultDir.mkdirs() + sourceDir.copyRecursively(resultDir) + mainIndexFile.appendText("- [$description]($dirName)\n") + } +} diff --git a/docs/cli/index.md b/kover-cli/docs/index.md similarity index 100% rename from docs/cli/index.md rename to kover-cli/docs/index.md diff --git a/kover-gradle-plugin/build.gradle.kts b/kover-gradle-plugin/build.gradle.kts index 37c1aa9d..0562a218 100644 --- a/kover-gradle-plugin/build.gradle.kts +++ b/kover-gradle-plugin/build.gradle.kts @@ -146,11 +146,9 @@ afterEvaluate { tasks.dokkaHtml { moduleName.set("Kover Gradle Plugin") - outputDirectory.set(rootProject.layout.projectDirectory.dir("docs/gradle-plugin/dokka").asFile) + outputDirectory.set(projectDir.resolve("docs/dokka")) - if (project.hasProperty("releaseVersion")) { - moduleVersion.set(project.property("releaseVersion") as String) - } + moduleVersion.set(project.property("kover.release.version").toString()) dokkaSourceSets.configureEach { // source set configuration section @@ -165,6 +163,22 @@ tasks.dokkaHtml { } } +tasks.register("releaseDocs") { + val dirName = "gradle-plugin" + val description = "Kover Gradle Plugin" + val sourceDir = projectDir.resolve("docs") + val resultDir = rootDir.resolve("docs/$dirName") + val mainIndexFile = rootDir.resolve("docs/index.md") + + dependsOn(tasks.dokkaHtml) + + doLast { + resultDir.mkdirs() + sourceDir.copyRecursively(resultDir) + mainIndexFile.appendText("- [$description]($dirName)\n") + } +} + extensions.configure { description.set("Kover Gradle Plugin - Kotlin code coverage") //`java-gradle-plugin` plugin already creates publication with name `pluginMaven` diff --git a/docs/gradle-plugin/configuring.md b/kover-gradle-plugin/docs/configuring.md similarity index 100% rename from docs/gradle-plugin/configuring.md rename to kover-gradle-plugin/docs/configuring.md diff --git a/docs/gradle-plugin/development/functionalTests.md b/kover-gradle-plugin/docs/development/functionalTests.md similarity index 100% rename from docs/gradle-plugin/development/functionalTests.md rename to kover-gradle-plugin/docs/development/functionalTests.md diff --git a/docs/gradle-plugin/html.png b/kover-gradle-plugin/docs/html.png similarity index 100% rename from docs/gradle-plugin/html.png rename to kover-gradle-plugin/docs/html.png diff --git a/docs/gradle-plugin/index.md b/kover-gradle-plugin/docs/index.md similarity index 100% rename from docs/gradle-plugin/index.md rename to kover-gradle-plugin/docs/index.md diff --git a/docs/gradle-plugin/migrations/migration-to-0.6.0.md b/kover-gradle-plugin/docs/migrations/migration-to-0.6.0.md similarity index 100% rename from docs/gradle-plugin/migrations/migration-to-0.6.0.md rename to kover-gradle-plugin/docs/migrations/migration-to-0.6.0.md diff --git a/docs/gradle-plugin/migrations/migration-to-0.7.0.md b/kover-gradle-plugin/docs/migrations/migration-to-0.7.0.md similarity index 100% rename from docs/gradle-plugin/migrations/migration-to-0.7.0.md rename to kover-gradle-plugin/docs/migrations/migration-to-0.7.0.md diff --git a/kover-offline-runtime/build.gradle.kts b/kover-offline-runtime/build.gradle.kts index 74638369..7286a5bf 100644 --- a/kover-offline-runtime/build.gradle.kts +++ b/kover-offline-runtime/build.gradle.kts @@ -51,3 +51,17 @@ tasks.jar { exclude("classpath.index") } } + +tasks.register("releaseDocs") { + val dirName = "offline-instrumentation" + val description = "Kover offline instrumentation" + val sourceDir = projectDir.resolve("docs") + val resultDir = rootDir.resolve("docs/$dirName") + val mainIndexFile = rootDir.resolve("docs/index.md") + + doLast { + resultDir.mkdirs() + sourceDir.copyRecursively(resultDir) + mainIndexFile.appendText("- [$description]($dirName)\n") + } +} diff --git a/docs/offline-instrumentation/index.md b/kover-offline-runtime/docs/index.md similarity index 100% rename from docs/offline-instrumentation/index.md rename to kover-offline-runtime/docs/index.md