diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..c60e014 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,55 @@ +name: Docs + +on: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build documentation with Dokka + run: ./gradlew :TeamCode:dokkaGeneratePublicationHtml --no-daemon + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./TeamCode/build/dokka/html + + 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 \ No newline at end of file diff --git a/TeamCode/build.gradle.kts b/TeamCode/build.gradle.kts index 633ad40..535005c 100644 --- a/TeamCode/build.gradle.kts +++ b/TeamCode/build.gradle.kts @@ -1,6 +1,8 @@ // // build.gradle in TeamCode // + +import java.time.Year // Most of the definitions for building your module reside in a common, shared // file 'build.common.gradle'. Being factored in this way makes it easier to // integrate updates to the FTC into your code. If you really need to customize @@ -16,11 +18,28 @@ plugins { id("com.android.application") id("org.jlleitschuh.gradle.ktlint") version "13.1.0" id("org.jetbrains.kotlin.android") + alias(libs.plugins.dokka) } // Include common definitions from above. apply { from("../build.common.gradle") } +// Dokka configuration +dokka { + dokkaPublications.html { + // Customize colors and styling + moduleName.set("Pioneer Robotics Documentation") + + pluginsConfiguration.html { + // Custom CSS for colors + // customStyleSheets.from("dokka-styles.css") + + // Footer text + footerMessage.set("© ${Year.now().value} Pioneer Robotics") + } + } +} + ktlint { android = true ignoreFailures = true // Allow build to succeed, but still show warnings @@ -61,4 +80,14 @@ dependencies { //kotlin { // jvmToolchain(8) -//} \ No newline at end of file +//} + +tasks.register("dokkaHtmlMultiModule") { + dependsOn(":TeamCode:dokkaGeneratePublicationHtml") + doLast { + copy { + from(layout.buildDirectory.dir("dokka/html")) + into(layout.projectDirectory.dir("../docs")) + } + } +} \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a647be4..bb3e0c9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,6 +3,7 @@ ftc = "11.0.0" androidx-appcompat = "1.2.0" dashboard = "0.5.1" junit = "4.13.2" +dokka = "2.1.0" [libraries] ftc-inspection = { module = "org.firstinspires.ftc:Inspection", version.ref = "ftc" } @@ -16,3 +17,6 @@ ftc-vision = { module = "org.firstinspires.ftc:Vision", version.ref = "ftc" } androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" } acmerobotics-dashboard = { module = "com.acmerobotics.dashboard:dashboard", version.ref = "dashboard" } junit = { module = "junit:junit", version.ref = "junit" } + +[plugins] +dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } diff --git a/settings.gradle.kts b/settings.gradle.kts index 067ece0..f6fefbd 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,2 @@ include(":FtcRobotController") -include(":TeamCode") +include(":TeamCode") \ No newline at end of file