Publish automatically JavaDoc: with GitHub Actions
Asked Answered
T

1

5

Introduction

I am currently working on a Java Maven project in GitHub, and I'm building a JavaDoc and posting it to a GitHub page.

Question

And I was wondering if it would be possible to automate this with a GitHub Actions, if so how?

Thor answered 4/2, 2022 at 19:13 Comment(1)
this question is duplicate: #72566040Afroamerican
O
5

JavaDoc publisher

Yes, it is possible with this code in your GitHub Actions directory:

name: Deploy Javadoc

on:
  push:
    branches:
      - master
      - main

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          javadoc-branch: javadoc
          java-version: 17
          target-folder: javadoc 

Credit: https://github.com/MathieuSoysal/Javadoc-publisher.yml https://github.com/marketplace/actions/deploy-publish-javadoc

Add the above YAML file to /.github/workflows/your-file.yaml inside your GitHub repository. It publishes the JavaDoc automatically when you publish to the "master" or "main" branch. Your JavaDoc is pushed onto the javadoc branch, and is deployed with GitHub Pages.

Don't forget to enable GitHub Pages on your GitHub repo settings

Outlandish answered 4/2, 2022 at 19:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.