diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2c13fa83..7748e3cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,6 +22,12 @@ jobs: run: ./gradlew build --stacktrace - name: Generate javadocs run: ./gradlew alljavadoc --stacktrace + - name: Deploy 🚀 + if: ${{ !contains(github.head_ref, 'renovate/') }} + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: build/docs/javadoc + target-folder: javadoc publish: needs: build runs-on: ubuntu-latest @@ -45,13 +51,3 @@ jobs: SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }} ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} - documentation: - needs: build - runs-on: ubuntu-latest - if: ${{ !contains(github.head_ref, 'renovate/') }} - steps: - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4 - with: - folder: build/docs/javadoc - target-folder: javadoc \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index b79d6383..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,44 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# GitHub recommends pinning actions to a commit SHA. -# To get a newer version, you will need to update the SHA. -# You can also reference a tag or branch, but the action may change without warning. - -# name: Publish package to the Maven Central Repository -# on: -# workflow_run: -# workflows: ["Build project and generate JavaDocs"] -# types: -# - completedWo -# -# jobs: -# publish: -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - name: Set up Java -# uses: actions/setup-java@v4 -# with: -# java-version: '21' -# distribution: 'temurin' -# - name: Validate Gradle wrapper -# uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 -# - name: Build -# run: ./gradlew build --stacktrace -# - name: Publish -# if: ${{ github.event_name == 'push' && !startsWith(github.ref, 'renovate/**') }} -# run: ./gradlew publish --stacktrace -# env: -# SONATYPE_USERNAME: ${{ secrets.OSSRH_USERNAME }} -# SONATYPE_PASSWORD: ${{ secrets.OSSRH_TOKEN }} -# ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} -# ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} -# - name: Generate javadocs -# run: ./gradlew alljavadoc --stacktrace -# - name: Deploy 🚀 -# uses: JamesIves/github-pages-deploy-action@v4 -# with: -# folder: build/docs/javadoc \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index d6a0ad5b..f9031005 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -143,11 +143,18 @@ tasks { "implSpec:a:Implementation Requirements", "implNote:a:Implementation Note" ) - val baseDir = file("${layout.buildDirectory.get()}/docs/javadoc/").toPath() - Documentation.buildJavadocIndexFile(baseDir.resolve("index.html"), rootProject.version.toString()) - setDestinationDir(baseDir.resolve(rootProject.version.toString()).toFile()) val projects = rootProject.allprojects setSource(projects.map { project -> project.sourceSets.main.get().allJava }) classpath = files(projects.map { project -> project.sourceSets.main.get().compileClasspath }) + //setDestinationDir(file("${layout.buildDirectory.get()}/docs/javadoc")) + setDestinationDir(file("${rootProject.layout.buildDirectory.get()}/docs/javadoc/${rootProject.version}")) + println(destinationDir?.toString()) + doLast { + try { + Documentation.buildJavadocIndexFile(file("${rootProject.layout.buildDirectory.get()}/docs/javadoc/index.html").toPath(), rootProject.version.toString()) + } catch (e: Exception) { + logger.error("Failed to build Javadoc index file", e) + } + } } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Documentation.kt b/buildSrc/src/main/kotlin/Documentation.kt index 939b2add..45ddab77 100644 --- a/buildSrc/src/main/kotlin/Documentation.kt +++ b/buildSrc/src/main/kotlin/Documentation.kt @@ -9,6 +9,7 @@ object Documentation { fun buildJavadocIndexFile(path: Path, version: String) { val document = if (!path.exists()) { + if (!path.parent.exists()) path.parent.createFile() path.createFile() generateNewIndexFile(path) } else Jsoup.parse(path.toFile()) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c491f746..5f5b6486 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,7 +8,7 @@ jackson-datatype-jsr310 = "2.18.0" jackson-yaml = "2.18.0" postgresql = "42.7.4" hikari = "6.0.0" -sadu = "2.3.0" +sadu = "2.3.1" junit = "5.11.1" paper-api = "1.20.6-R0.1-SNAPSHOT" brigadier = "1.0.500"