Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
book-open

GitHub Action

Deploy - Publish Javadoc

v2.3.2

Deploy - Publish Javadoc

book-open

Deploy - Publish Javadoc

Automatically generate your JavaDoc and publish it to GitHub Page

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Deploy - Publish Javadoc

uses: MathieuSoysal/Javadoc-publisher.yml@v2.3.2

Learn more about this action in MathieuSoysal/Javadoc-publisher.yml

Choose a version

Deploy Publish JavaDoc

Public workflows that use this action. Test Actions(Tested on Java 8, 11, 17, 19, Maven, Gradle, Ubuntu, Macos, Windows)

Automatically generate Javadoc from your Java project and publish it to GitHub Page.

Requirements

  • Your project need to use Maven or Gradle.

Usage

For Maven project

The workflow, usually declared in .github/workflows/publish-javadoc.yml, looks like:

.github/workflows/publish-javadoc-maven.yml
name: Deploy Javadoc

on:
  push:
    branches:
      - master
      - main

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy JavaDoc πŸš€
        uses: MathieuSoysal/Javadoc-publisher.yml@v2.3.0
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          javadoc-branch: javadoc
          java-version: 17
          target-folder: javadoc # url will be https://<username>.github.io/<repo>/javadoc
          project: maven # or gradle

For Gradle project

The workflow, usually declared in .github/workflows/publish-javadoc.yml, looks like:

.github/workflows/publish-javadoc-gradle.yml
name: Deploy Javadoc

on:
  push:
    branches:
      - master
      - main

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy JavaDoc πŸš€
        uses: MathieuSoysal/Javadoc-publisher.yml@v2.3.0
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          javadoc-branch: javadoc
          java-version: 17
          target-folder: javadoc 
          project: gradle

With custom command for generating Javadoc

If you want to use a custom command for generating Javadoc, you can use the custom-command input. This input is a string that will be executed in the root of your project. For example, if you want to use the javadoc command, you can use the following workflow:

.github/workflows/publish-javadoc-custom-command.yml
name: Deploy Javadoc

on:
  push:
    branches:
      - master
      - main

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy JavaDoc πŸš€
        uses: MathieuSoysal/Javadoc-publisher.yml@v2.3.0
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          javadoc-branch: javadoc
          java-version: 17
          target-folder: javadoc 
          project: gradle
          custom-command: javadoc -d javadoc -sourcepath src/main/java -subpackages .

GitHub page

Don't forget to configure your repository settings with your new GitHub Page. πŸ˜‰

Badge

[![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://YOUR-USERNAME.github.io/YOUR-REPO/javadoc/)

In the badge link, replace YOUR-USERNAME with your GitHub Username and replace YOUR-REPO with the name of your GitHub repository.

License

The Dockerfile and associated scripts and documentation in this project are released under the Apache 2.0 License.