From 3b193213ab4308aba9c9f1e0bd695f7e4c674796 Mon Sep 17 00:00:00 2001 From: adamkobor Date: Thu, 18 Jan 2024 13:57:22 +0100 Subject: [PATCH] improve doc generation --- .github/workflows/deploy-gh-pages.yml | 7 ++++--- build.gradle.kts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-gh-pages.yml b/.github/workflows/deploy-gh-pages.yml index 76e0ee8..b27221c 100644 --- a/.github/workflows/deploy-gh-pages.yml +++ b/.github/workflows/deploy-gh-pages.yml @@ -6,8 +6,6 @@ on: - '*' # To make it able to run manually, TODO remove when we're sure it's working workflow_dispatch: -env: - VERSION: "${{ github.ref_name }}" jobs: build: runs-on: ubuntu-latest @@ -26,9 +24,12 @@ jobs: - name: Setup Pages id: pages uses: actions/configure-pages@v4 + - name: 'Get Previous tag' + id: lasttag + uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: Generate API documentation run: | - ./gradlew -Pversion=$VERSION dokkaHtml + ./gradlew -PdocVersion=${{ steps.lasttag.outputs.tag }} dokkaHtml # Uploading the generated files as build artifacts - name: Upload artifact uses: actions/upload-pages-artifact@v3 diff --git a/build.gradle.kts b/build.gradle.kts index 3ad6c44..bd21fa6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import java.net.URL + plugins { kotlin("jvm") id("com.lovelysystems.gradle") @@ -60,6 +62,20 @@ dependencies { testImplementation(testLibs.logback) } +tasks.dokkaHtml { + val versionToUse = (project.findProperty("docVersion") as? String?) ?: project.version.toString() + moduleVersion.set(versionToUse) + dokkaSourceSets { + named("main") { + sourceLink { + localDirectory.set(projectDir.resolve("src")) + remoteUrl.set(URL("https://github.com/lovelysystems/lovely-jooq/tree/master/src")) + remoteLineSuffix.set("#L") + } + } + } +} + publishing { repositories { maven {