Code Monkey home page Code Monkey logo

javadoc-publisher.yml's Introduction

Deploy Publish JavaDoc

Public workflows that use this action. Test Actions (Tested on Java 8, 11, 17, 19, 21, 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.

Inputs

input description default
java-version java version inside your project 17
GITHUB_TOKEN The GitHub token the GitHub repository
deploy-mode Deploy mode can be branch or artifact branch
javadoc-branch Branch where the javadoc is hosted javadoc
target-folder Directory where the javadoc contents should be stored .
java-distribution Java distribution inside your project adopt
project Maven or Gradle project maven
custom-command Custom command to generate the javadoc ""
subdirectories Custom subdirectories to upload from
without-deploy Enable or disable deploy of the javadoc to the GitHub Page false
without-checkout Enable or disable the checkout false
javadoc-source-folder The folder where our project generate the JavaDoc target/site/apidocs

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
    permissions:
      contents: write  # if you have a protection rule on your repository, you'll need to give write permission to the workflow.
    steps:
      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          javadoc-branch: javadoc
          java-version: 17
          target-folder: javadoc # url will be https://<username>.github.io/<repo>/javadoc, This can be left as nothing to generate javadocs in the root folder.
          project: maven # or gradle
          # subdirectories: moduleA moduleB #for subdirectories support, needs to be run with custom command

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
    permissions:
      contents: write  # if you have a protection rule on your repository, you'll need to give write permission to the workflow.
    steps:
      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        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
    permissions:
      contents: write  # if you have a protection rule on your repository, you'll need to give write permission to the workflow.
    steps:
      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        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 .

Deploy with artifact

If you want to deploy the javadoc as an artifact, you can use the deploy-mode input. Set the deploy-mode to artifact and the javadoc will be deployed as an artifact, so you don't need a javadoc branch.

name: Deploy Javadoc

on:
  push:
    branches:
      - master
      - main
concurrency:
  group: pages
  cancel-in-progress: false
jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      permissions:
        contents: read
        pages: write
        id-token: write
    steps:
      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          deploy-mode: artifact
          java-version: 17
          project: maven # or gradle
          # subdirectories: moduleA moduleB #for subdirectories support, needs to be run with custom command

GitHub page

Remember to configure your repository settings with your new GitHub Page. 😉

Help to set up the GitHub Pages settings in your repository

If you need to use the specified directory to store the javadoc, You need to do this on your Settings page. Like this.

GitHub-Page-settings

Not only that, but if you have README.md file in your javadoc branch, the access will show up just as well. and doing so does not affect the javadoc commit.

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.

Contributing

Want to contribute to Javadoc Publisher? Awesome! Check out the contributing guidelines to get involved.

Requirements to your environment to test in locally

Command to test your changes

act workflow_dispatch -W .github/workflows/test-action-local.yml -P ubuntu-latest=quay.io/jamezp/act-maven

Contributors

Contributors

Stars 🎇

If you like or use this project, please remember to give it a star ⭐️. Thanks!

License

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

javadoc-publisher.yml's People

Contributors

brenoepics avatar dependabot[bot] avatar finest-creation avatar github-actions[bot] avatar jadur10 avatar klungerbo avatar lunasaw avatar mathieusoysal avatar n-tdi avatar priyankdixit avatar psub avatar sinedied avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

javadoc-publisher.yml's Issues

Installed as per README, nothing appears on github pages.

Hello! I hope you're doing great.

My project is https://github.com/MarginallyClever/Robot-Overlord-App/.
I used the recommended publish-javadoc-maven.yml and verified github > settings > pages were set correctly. I am only publishing on updates to the javadoc branch and I'm set to the docs folder, default settings.

Jekyll logs show that my ./docs/README.md is being rendered, but nothing else. No javadoc is being generated. What did I miss?

Probably a separate issue but I'd like to exclude one folder from the javadoc build, some old code that doesn't need to confuse people downstream. Any ideas?

Thanks!

Integrate Gradle

Current problem

Currently the JavaDoc Publisher doesn't support Gradle project.

Proposition

To fix this, it is possible to detect if the repo uses Maven or Gradle, before the Javadoc generation. And adapt the JavaDoc generation accordingly.

Checking proposition

To detect if the project use Maven or Gradle we can just check if the project contains a pom.xml

Javadoc execution with Gradle

To execute Javadoc with Gradle we can use this solution: https://stackoverflow.com/a/70988302/15186569

Doc: Inputs list

Problem

Currently, we cannot see directly all possible inputs with Javadoc-publisher.yml, and we need to check them manually inside the action.yml file to see inputs.

Solution

To resolve it we can add a section like that:

Inputs

input description default
java-version the java version your project 11

To easily create a Markdown table : stevecat/table-magic.

uploading javadocs to root directory instead of `javadocs/` folder

Hello! I was wondering if it was possible to allow the Javadoc's to have the option to be created in the root folder.

I was looking at #27 and I think this may have already done what I need, but I am unsure of how to use it!

The reason why I would like this is because I have a domain docs.example.com and want to host the javadocs on the subdomain without having it to be docs.example.com/javadocs

This would be really appreciated!

Simplify the yaml.file

Current problem

Currently the yaml file to publish JavaDoc is this:

name: Deploy Javadoc

on:
  push:
    branches:
      - master

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-java@v2
        with:
          java-version: 17
          distribution: 'adopt'
      - name: Generate Javadoc
        run: mvn org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:aggregate
      - name: Deploy 🚀
        uses: JamesIves/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          BRANCH: javadoc
          CLEAN: true
          FOLDER: target/site/apidocs
          TARGET_FOLDER: javadoc

It's a bit long.

Solution

It's possible to reduce the yaml file to obtain this:

name: Deploy Javadoc

on:
  push:
    branches:
      - master

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

Via composite GitHub Actions

Fix: Contributors CI

Problem

Currently, the contributor CI doesn't work because the repo has a security counter direct commit.

log
Run wow-actions/contributors-list@v1
contributors: 6, [
  "MathieuSoysa...",
  "jadur10",
  "pSub",
  "Klungerbo",
  "n-tdi",
  "sinedied"
]
collaborators: 4, [
  "pSub",
  "MathieuSoysa...",
  "n-tdi",
  "jadur10"
]
bots: 1, [
  "dependabot[b..."
]
Error: HttpError: Could not update file: At least 1 approving review is required by reviewers with write access.

https://github.com/MathieuSoysal/Javadoc-publisher.yml/actions/runs/4218070377/jobs/7322300565

Solution

To resolve it we can use Pull Request instead of direct commit, to do that we can :

Use the custom Javadoc plugin in the project

Introduction

Currently, the GitHub Action uses its own Javadoc plugin.

Problem

Sometimes the java project has its own customized Javadoc plugin, but in this case, the GitHub Action ignores that.

Solution

Before executing the mvn command to generate the Javadoc, the GitHub Action needs to check if the Java Project has its own JavaDoc plugin.

Depolying failure

Just starting using this action for my side project, super cool! Thanks for the great work.
The first publish action to javadoc branch seems to succeed, but all the ones after it fail, although the javadoc compilation succeed.
Here is a log from one of the builds:

Run actions/jekyll-build-pages@v1
/usr/bin/docker run --name ghcrioactionsjekyllbuildpagesv107_2d5cd4 --label 6c0442 --workdir /github/workspace --rm -e "INPUT_SOURCE" -e "INPUT_DESTINATION" -e "INPUT_FUTURE" -e "INPUT_BUILD_REVISION" -e "INPUT_VERBOSE" -e "INPUT_TOKEN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_ID_TOKEN_REQUEST_URL" -e "ACTIONS_ID_TOKEN_REQUEST_TOKEN" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/JGAlgo/JGAlgo":"/github/workspace" ghcr.io/actions/jekyll-build-pages:v1.0.7
Configuration file: none
  Logging at level: debug
      GitHub Pages: github-pages v228
      GitHub Pages: jekyll v3.[9](https://github.com/barakugav/JGAlgo/actions/runs/4508470596/jobs/7937203037#step:4:10).3
             Theme: jekyll-theme-primer
      Theme source: /usr/local/bundle/gems/jekyll-theme-primer-0.6.0
         Requiring: jekyll-github-metadata
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
  Conversion error: Jekyll::Converters::Scss encountered an error while converting 'assets/css/style.scss':
                    No such file or directory @ dir_chdir - /github/workspace/docs
/usr/local/bundle/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:86:in `chdir': No such file or directory @ dir_chdir - /github/workspace/docs (Errno::ENOENT)
	from /usr/local/bundle/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:86:in `sass_load_paths'
	from /usr/local/bundle/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:114:in `sass_configs'
	from /usr/local/bundle/gems/jekyll-sass-converter-1.5.2/lib/jekyll/converters/scss.rb:119:in `convert'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/renderer.rb:[10](https://github.com/barakugav/JGAlgo/actions/runs/4508470596/jobs/7937203037#step:4:11)1:in `block in convert'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/renderer.rb:99:in `each'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/renderer.rb:99:in `reduce'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/renderer.rb:99:in `convert'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/renderer.rb:83:in `render_document'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/renderer.rb:62:in `run'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/site.rb:479:in `render_regenerated'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/site.rb:472:in `block in render_pages'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/site.rb:471:in `each'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/site.rb:471:in `render_pages'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/site.rb:192:in `render'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/site.rb:71:in `process'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/command.rb:28:in `process_site'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:65:in `build'
	from /usr/local/bundle/gems/jekyll-3.9.3/lib/jekyll/commands/build.rb:36:in `process'
	from /usr/local/bundle/gems/github-pages-228/bin/github-pages:70:in `block (3 levels) in <top (required)>'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
	from /usr/local/bundle/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
	from /usr/local/bundle/gems/github-pages-228/bin/github-pages:6:in `<top (required)>'
	from /usr/local/bundle/bin/github-pages:23:in `load'
	from /usr/local/bundle/bin/github-pages:23:in `<main>'
         Requiring: jekyll-seo-tag
         Requiring: jekyll-coffeescript
         Requiring: jekyll-commonmark-ghpages
         Requiring: jekyll-gist
         Requiring: jekyll-github-metadata
         Requiring: jekyll-paginate
         Requiring: jekyll-relative-links
         Requiring: jekyll-optional-front-matter
         Requiring: jekyll-readme-index
         Requiring: jekyll-default-layout
         Requiring: jekyll-titles-from-headings
   GitHub Metadata: Initializing...
            Source: /github/workspace/./docs
       Destination: /github/workspace/./docs/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
        Generating: JekyllOptionalFrontMatter::Generator finished in 1.21e-05 seconds.
        Generating: JekyllReadmeIndex::Generator finished in 6.2e-06 seconds.
        Generating: Jekyll::Paginate::Pagination finished in 3.1e-06 seconds.
        Generating: JekyllRelativeLinks::Generator finished in 2.7901e-05 seconds.
        Generating: JekyllDefaultLayout::Generator finished in 1.[15](https://github.com/barakugav/JGAlgo/actions/runs/4508470596/jobs/7937203037#step:4:16)e-05 seconds.
        Generating: JekyllTitlesFromHeadings::Generator finished in 7.8e-06 seconds.
         Rendering: assets/css/style.scss
  Pre-Render Hooks: assets/css/style.scss
  Rendering Markup: assets/css/style.scss
github-pages [22](https://github.com/barakugav/JGAlgo/actions/runs/4508470596/jobs/7937203037#step:4:23)8 | Error:  No such file or directory @ dir_chdir - /github/workspace/docs

The task was successfully executed, but the branch was not created

name: Deploy Javadoc

on:
  push:
    branches:
      - master
jobs:
  publish:
    environment: dep 
    runs-on: ubuntu-latest
    steps:
      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.SECRET_KEY }}
          javadoc-branch: javadoc
          java-version: 8
          target-folder: docs
          without-deploy: true

Hello, I would like to ask you a question. This task has been successfully executed but my branch has not been created. Is it my configuration proble

https://github.com/lunasaw/webdav-spring-boot-starter/actions/runs/4596969980/jobs/8119087725

"Deploy JavaDoc" step fails

Hi there,

I tried to use this GitHub action in order to auto-generate the JavaDocs and publish them via GitHub Pages. Unfortunately, the "Deploy JavaDoc" step fails:

Error:  Failed to execute goal on project spaced-repetition-software: Could not resolve dependencies for project de.nickhansen:spaced-repetition-software:jar:1.0-SNAPSHOT: Could not find artifact de.nickhansen:spaced-repetition-api:jar:1.0-SNAPSHOT -> [Help 1]
Error:  
Error:  To see the full stack trace of the errors, re-run Maven with the -e switch.
Error:  Re-run Maven using the -X switch to enable full debug logging.
Error:  
Error:  For more information about the errors and possible solutions, please read the following articles:
Error:  [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Error:  
Error:  After correcting the problems, you can resume the build with the command
Error:    mvn <args> -rf :spaced-repetition-software
Error: Process completed with exit code 1.

I cannot locate any error since the "Java CI with Maven" action works correctly (the quoted error does not occur): https://github.com/nickhnsn/facharbeit-spaced-repetition/actions/runs/3920596521/jobs/6702319142
How to fix this issue?

Give help with deploy error

Introduction

Currently, when we have a protection rule on the repository, the standard usage of ${{ secrets.GITHUB_TOKEN }} doesn't work.

Log example:

    ╭━━━╮╭╮╭╮╱╭╮╱╱╭╮╱╱╭━━━╮
    ┃╭━╮┣╯╰┫┃╱┃┃╱╱┃┃╱╱┃╭━╮┃
    ┃┃╱╰╋╮╭┫╰━╯┣╮╭┫╰━╮┃╰━╯┣━━┳━━┳━━┳━━╮
    ┃┃╭━╋┫┃┃╭━╮┃┃┃┃╭╮┃┃╭━━┫╭╮┃╭╮┃┃━┫━━┫
    ┃╰┻━┃┃╰┫┃╱┃┃╰╯┃╰╯┃┃┃╱╱┃╭╮┃╰╯┃┃━╋━━┃
    ╰━━━┻┻━┻╯╱╰┻━━┻━━╯╰╯╱╱╰╯╰┻━╮┣━━┻━━╯
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯
    ╭━━━╮╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╭━━━╮╱╱╭╮
    ╰╮╭╮┃╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱┃╭━╮┃╱╭╯╰╮
    ╱┃┃┃┣━━┳━━┫┃╭━━┳╮╱╭╮┃┃╱┃┣━┻╮╭╋┳━━┳━╮
    ╱┃┃┃┃┃━┫╭╮┃┃┃╭╮┃┃╱┃┃┃╰━╯┃╭━┫┃┣┫╭╮┃╭╮╮
    ╭╯╰╯┃┃━┫╰╯┃╰┫╰╯┃╰━╯┃┃╭━╮┃╰━┫╰┫┃╰╯┃┃┃┃
    ╰━━━┻━━┫╭━┻━┻━━┻━╮╭╯╰╯╱╰┻━━┻━┻┻━━┻╯╰╯
    ╱╱╱╱╱╱╱┃┃╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╰╯╱╱╱╱╱╱╰━━╯
    

    💖 Support: https://github.com/sponsors/JamesIves
    📣 Maintained by James Ives: https://jamesiv.es

    🚀 Getting Started Guide: https://github.com/JamesIves/github-pages-deploy-action
    ❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
    🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config --global --add safe.directory /home/runner/work/42-Check-in-automation/42-Check-in-automation
/usr/bin/git config user.name MathieuSoysal
/usr/bin/git config user.email [email protected]
/usr/bin/git config core.ignorecase false
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
/usr/bin/git remote rm origin
/usr/bin/git remote add origin ***github.com/MathieuSoysal/42-Check-in-automation.git
Git configured… 🔧
Starting to commit changes…
/usr/bin/git ls-remote --heads ***github.com/MathieuSoysal/42-Check-in-automation.git refs/heads/archive
Creating worktree…
/usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
Preparing worktree (detached HEAD f7b8a18)
/usr/bin/git checkout --orphan archive
Switched to a new branch 'archive'
Created the archive branch… 🔧
/usr/bin/git reset --hard
/usr/bin/git commit --no-verify --allow-empty -m Initial archive commit
[archive (root-commit) 55eab06] Initial archive commit
/usr/bin/chmod -R +rw /home/runner/work/42-Check-in-automation/42-Check-in-automation/archive
Creating target folder if it doesn't already exist… 📌
/usr/bin/rsync -q -av --checksum --progress /home/runner/work/42-Check-in-automation/42-Check-in-automation/archive/. github-pages-deploy-action-temp-deployment-folder/archive/ --exclude .ssh --exclude .git --exclude .github
Checking if there are files to commit…
/usr/bin/git add --all .
/usr/bin/git checkout -b github-pages-deploy-action/f33zt0f33
Switched to a new branch 'github-pages-deploy-action/f33zt0f33'
/usr/bin/git commit -m Deploying to archive from @ MathieuSoysal/42-Check-in-automation@f7b8a18fa5f5889d6309c63b9f3c693536[15](https://github.com/MathieuSoysal/42-Check-in-automation/actions/runs/4832803779/jobs/8612034038#step:7:16)c129 🚀 --quiet --no-verify
Force-pushing changes...
/usr/bin/git push --force ***github.com/MathieuSoysal/42-Check-in-automation.git github-pages-deploy-action/f33zt0f33:archive
remote: Permission to MathieuSoysal/42-Check-in-automation.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/MathieuSoysal/42-Check-in-automation.git/': The requested URL returned error: 403
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/f33zt0f33
Reset branch 'github-pages-deploy-action/f33zt0f33'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 1[28](https://github.com/MathieuSoysal/42-Check-in-automation/actions/runs/4832803779/jobs/8612034038#step:7:29) ❌
Notice: Deployment failed! ❌

Problem

The problem, sometimes the user doesn't where the problem comes, from and can be more fastidious to using the Javadoc-publisher.

Solution

When the deploying step fails we can guide him inside GitHub Actions Doc, and invite him to ask the question inside the JavaDoc-publisher repository.

Some documents that can help the user to fix the deploy error:

Accord the permission to create a new branch: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests

Setting a Personal Access Token inside of ${{ secrets.GITHUB_TOKEN }}: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

An example of the code that we need to add to guide the user:

## Yaml code of deploy step
if: failure()
  run: echo "Fail during the deploy step. Check your discussion --URL-- to get more help, don't hesitate to ask your question on our discussion to get help."

Add possibility to add custom command

Introduction

Currently, the GitHub Action uses a library injection to add JavaDoc inside the pom.

Problem

With this solution, we can't config the GitHub Actions to use the custom JavaDoc library inside the current project.
And we can't add arguments for the JavaDoc generation.

Solution

We can add a custom command like this:

      - name: Deploy JavaDoc 🚀
        uses: MathieuSoysal/[email protected]
        with:
          custom-command: mvn javadoc:aggregate pl name

The resources to help the implementation:

Customization of the folder destination of the generated Javadoc

Introduction

Currently, the generated Javadoc is got by default from target/site/apidocs for the Maven project and build/docs/javadoc for the Gradle project.

Problem

But sometimes the project of the user doesn't generate the Javadoc to these folders, in this case, the GitHub Actions doesn't work.

Example of the problem: #48

Solution

To resolve this we can a new input to the GitHub Action here

To add the possibility to customize javadoc-source-folder for maven and javadoc-source-folder for gradle.

Example of use :

  publish:
    runs-on: ubuntu-latest
    steps:
    - name: Deploy javadoc
      uses: MathieuSoysal/[email protected]
      with:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        javadoc-branch: javadoc
        java-version: 11
        target-folder: javadoc # url will be https://<username>.github.io/<repo>/javadoc, This can be left as nothing to generate javadocs in the root folder.
        project: maven
        subdirectories: modelstore.services modelstore.backend
        javadoc-source-folder: target/apidocs/

The feature in question:

        javadoc-source-folder: target/apidocs/

Note for add this

To add this feature we need to change all occurrences of this folder with the GitHub Action input inside these lines

Add automated test

Current problem

Currently, we don't have any automated tests inside the project. This is a little problematic for the contribution, a contributor can't test if the added feature works correctly.

Solution to fix this

It's probably possible to use https://github.com/nektos/act inside a CI, to execute this JavaDoc publisher with a empty project.

Deploy reports success, but no Javadoc was actually published.

Hi, thank you for creating action. I just have one problem and I don't know whether this is a bug, or I'm doing something wrong.
In my project ScalaPluginLoader I use this action to generate javadoc for 4 out of the 8 maven modules using a custom command: mvn package javadoc:aggregate -pl :ScalaPluginLoader,:ScalaLoader-Common,:ScalaLoader-Bukkit,:ScalaLoader-Paper. This seems to work well - the Javadoc is generated and available on the javadoc branch, but the deployment to GitHub Pages is failing, despite it's saying it succeeded. I expect the Javadoc to be available at https://Jannyboy11.github.io/ScalaPluginLoader/javadoc, but GitHub reports a 404.

I was hoping you would be able to assist me, thanks in advance!

My setup:
Project Layout (maven):

ScalaPluginLoader
+--ScalaLoader-Common
+--ScalaLoader-Bukkit
+--ScalaLoader-Paper
.... 4 more submodules for which I do not want to generate javadoc

GH actions workflow steps:

      - name: Deploy Javadoc
        uses: MathieuSoysal/[email protected]
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          javadoc-branch: javadoc
          java-distribution: temurin
          java-version: 20
          custom-command: 'mvn package javadoc:aggregate -pl :ScalaPluginLoader,:ScalaLoader-Common,:ScalaLoader-Bukkit,:ScalaLoader-Paper'
          target-folder: javadoc # url will be https://<username>.github.io/<repo>/javadoc, This can be left as nothing to generate javadocs in the root folder.
          project: maven # or gradle
Logs
Run JamesIves/[email protected]

    ╭━━━╮╭╮╭╮╱╭╮╱╱╭╮╱╱╭━━━╮
    ┃╭━╮┣╯╰┫┃╱┃┃╱╱┃┃╱╱┃╭━╮┃
    ┃┃╱╰╋╮╭┫╰━╯┣╮╭┫╰━╮┃╰━╯┣━━┳━━┳━━┳━━╮
    ┃┃╭━╋┫┃┃╭━╮┃┃┃┃╭╮┃┃╭━━┫╭╮┃╭╮┃┃━┫━━┫
    ┃╰┻━┃┃╰┫┃╱┃┃╰╯┃╰╯┃┃┃╱╱┃╭╮┃╰╯┃┃━╋━━┃
    ╰━━━┻┻━┻╯╱╰┻━━┻━━╯╰╯╱╱╰╯╰┻━╮┣━━┻━━╯
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰━━╯
    ╭━━━╮╱╱╱╱╱╭╮╱╱╱╱╱╱╱╱╭━━━╮╱╱╭╮
    ╰╮╭╮┃╱╱╱╱╱┃┃╱╱╱╱╱╱╱╱┃╭━╮┃╱╭╯╰╮
    ╱┃┃┃┣━━┳━━┫┃╭━━┳╮╱╭╮┃┃╱┃┣━┻╮╭╋┳━━┳━╮
    ╱┃┃┃┃┃━┫╭╮┃┃┃╭╮┃┃╱┃┃┃╰━╯┃╭━┫┃┣┫╭╮┃╭╮╮
    ╭╯╰╯┃┃━┫╰╯┃╰┫╰╯┃╰━╯┃┃╭━╮┃╰━┫╰┫┃╰╯┃┃┃┃
    ╰━━━┻━━┫╭━┻━┻━━┻━╮╭╯╰╯╱╰┻━━┻━┻┻━━┻╯╰╯
    ╱╱╱╱╱╱╱┃┃╱╱╱╱╱╱╭━╯┃
    ╱╱╱╱╱╱╱╰╯╱╱╱╱╱╱╰━━╯
    

    💖 Support: https://github.com/sponsors/JamesIves
    📣 Maintained by James Ives: https://jamesiv.es/

    🚀 Getting Started Guide: https://github.com/JamesIves/github-pages-deploy-action
    ❓ Discussions / Q&A: https://github.com/JamesIves/github-pages-deploy-action/discussions
    🔧 Report a Bug: https://github.com/JamesIves/github-pages-deploy-action/issues
Checking configuration and starting deployment… 🚦
Deploying using Deploy Token… 🔑
Configuring git…
/usr/bin/git config --global --add safe.directory /home/runner/work/ScalaPluginLoader/ScalaPluginLoader
/usr/bin/git config user.name Jannyboy11
/usr/bin/git config user.email [email protected]
/usr/bin/git config core.ignorecase false
/usr/bin/git config --local --unset-all http.https://github.com/.extraheader
/usr/bin/git remote rm origin
/usr/bin/git remote add origin ***github.com/Jannyboy11/ScalaPluginLoader.git
Git configured… 🔧
Starting to commit changes…
/usr/bin/git ls-remote --heads ***github.com/Jannyboy11/ScalaPluginLoader.git refs/heads/javadoc
Creating worktree…
/usr/bin/git worktree add --no-checkout --detach github-pages-deploy-action-temp-deployment-folder
Preparing worktree (detached HEAD 9771d41)
/usr/bin/git checkout --orphan javadoc
Switched to a new branch 'javadoc'
Created the javadoc branch… 🔧
/usr/bin/git reset --hard
/usr/bin/git commit --no-verify --allow-empty -m Initial javadoc commit
[javadoc (root-commit) 08617fa] Initial javadoc commit
/usr/bin/chmod -R +rw /home/runner/work/ScalaPluginLoader/ScalaPluginLoader/target/site/apidocs
Creating target folder if it doesn't already exist… 📌
/usr/bin/rsync -q -av --checksum --progress /home/runner/work/ScalaPluginLoader/ScalaPluginLoader/target/site/apidocs/. github-pages-deploy-action-temp-deployment-folder/javadoc --delete --exclude CNAME --exclude .nojekyll --exclude .ssh --exclude .git --exclude .github
Checking if there are files to commit…
/usr/bin/git add --all .
/usr/bin/git checkout -b github-pages-deploy-action/qzqjyglyo
Switched to a new branch 'github-pages-deploy-action/qzqjyglyo'
/usr/bin/git commit -m Deploying to javadoc from @ Jannyboy11/ScalaPluginLoader@9771d41784cbc6ea874313f1fb815cdca81a711b 🚀 --quiet --no-verify
Force-pushing changes...
/usr/bin/git push --force ***github.com/Jannyboy11/ScalaPluginLoader.git github-pages-deploy-action/qzqjyglyo:javadoc
remote: 
remote: Create a pull request for 'javadoc' on GitHub by visiting:        
remote:      https://github.com/Jannyboy11/ScalaPluginLoader/pull/new/javadoc        
remote: 
To https://github.com/Jannyboy11/ScalaPluginLoader.git
 * [new branch]      github-pages-deploy-action/qzqjyglyo -> javadoc
Changes committed to the javadoc branch… 📦
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/qzqjyglyo
Reset branch 'github-pages-deploy-action/qzqjyglyo'
/usr/bin/chmod -R +rw github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Completed deployment successfully! ✅

Simplified tests for contributors

Problematic

Currently the repo doesn't have a tutorial to show how to test javadoc-publisher.

And doesn't have minimized tests for a local testing.

Solution

  • Need to add a tutorial to tests in locally
  • Need to minimized tests to run it locally

Support for nested directories

I have a monorepo for couple of maven projects such as
A(root)
|-B
|-C
While deploying, only javadoc from the root project (A) is included, however I would like to include javadocs for B and C.
Suggested way would be to specify (optional) subdirectories in the yaml configuration and upload the generated javadocs to javadoc/<folder_name> in the target github.io page.

Add contributors list

Problem

The Javadoc-publisher.yml project doesn't have a contributors list at the end of the README.md.

Solution

To resolve it we can use this GitHub Actions : contributors-list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.