From 44c3862d8d1473b8d4f5420e7ecfaff8c3ab46fd Mon Sep 17 00:00:00 2001 From: Abhishek Date: Fri, 14 Mar 2025 16:54:20 +0100 Subject: [PATCH] feat: Generate javadocs and publish on GH Pages --- .github/workflows/gen-java-docs.yml | 35 +++++++++++++++++++++++++++++ pom.xml | 20 +++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/gen-java-docs.yml diff --git a/.github/workflows/gen-java-docs.yml b/.github/workflows/gen-java-docs.yml new file mode 100644 index 00000000..f15e03cc --- /dev/null +++ b/.github/workflows/gen-java-docs.yml @@ -0,0 +1,35 @@ +name: Generate Java Docs + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: 11 + distribution: corretto + + - name: Build with Maven + run: mvn clean install + + - name: Generate Javadocs + run: mvn javadoc:javadoc + + # Publishes Javadocs to GitHub Pages by pushing to `gh-pages` branch + - name: Deploy Javadocs to GitHub Pages + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + mvn scm-publish:publish-scm + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 69a41969..e93e0ff2 100644 --- a/pom.xml +++ b/pom.xml @@ -393,6 +393,15 @@ maven-compiler-plugin + + + default-compile + generate-sources + + compile + + + 11 11 @@ -509,6 +518,7 @@ org.apache.maven.plugins maven-javadoc-plugin + 3.3.1 attach-javadocs @@ -522,6 +532,16 @@ none + + org.apache.maven.plugins + maven-scm-publish-plugin + 1.0 + + target/site/apidocs + scm:git:git@github.com:spotify/github-java-client.git + gh-pages + +