Refactor JavaDoc generation and verification steps

This commit is contained in:
Relism
2026-05-12 16:28:20 +02:00
committed by GitHub
parent c368843ad4
commit c619c17949
+27 -11
View File
@@ -51,21 +51,35 @@ jobs:
# this produces a single aggregated Javadoc covering all modules. # this produces a single aggregated Javadoc covering all modules.
# Default output path: target/site/apidocs/ (no custom reportOutputDirectory set). # Default output path: target/site/apidocs/ (no custom reportOutputDirectory set).
- name: Generate aggregated JavaDoc - name: Generate aggregated JavaDoc
run: mvn -B --settings .github/settings.xml javadoc:aggregate -DskipTests run: |
mvn -B \
--settings .github/settings.xml \
-DskipTests \
org.apache.maven.plugins:maven-javadoc-plugin:3.6.3:aggregate
env: env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Verify JavaDoc output exists - name: Verify JavaDoc output exists
run: | run: |
if [ ! -f "target/site/apidocs/index.html" ]; then APIDOCS=""
echo "ERROR: target/site/apidocs/index.html not found."
echo "Contents of target/site (if any):" if [ -f "target/site/apidocs/index.html" ]; then
find target/site -maxdepth 3 2>/dev/null || echo "(empty)" APIDOCS="target/site/apidocs"
elif [ -f "target/reports/apidocs/index.html" ]; then
APIDOCS="target/reports/apidocs"
else
echo "ERROR: JavaDoc output not found."
echo
echo "Contents of target/:"
find target -maxdepth 5 2>/dev/null || echo "(empty)"
exit 1 exit 1
fi fi
COUNT=$(find target/site/apidocs -name '*.html' | wc -l)
echo "JavaDoc OK — $COUNT HTML files at target/site/apidocs/" echo "APIDOCS_DIR=$APIDOCS" >> $GITHUB_ENV
COUNT=$(find "$APIDOCS" -name '*.html' | wc -l)
echo "JavaDoc OK — $COUNT HTML files at $APIDOCS"
- name: Checkout gh-pages - name: Checkout gh-pages
uses: actions/checkout@v4 uses: actions/checkout@v4
@@ -77,11 +91,13 @@ jobs:
- name: Copy JavaDoc to versioned folder and latest - name: Copy JavaDoc to versioned folder and latest
run: | run: |
VERSION=${{ inputs.version }} VERSION=${{ inputs.version }}
mkdir -p gh-pages-out/javadoc/$VERSION mkdir -p gh-pages-out/javadoc/$VERSION
cp -r target/site/apidocs/. gh-pages-out/javadoc/$VERSION/ cp -r "$APIDOCS_DIR"/. gh-pages-out/javadoc/$VERSION/
rm -rf gh-pages-out/latest rm -rf gh-pages-out/latest
mkdir -p gh-pages-out/latest mkdir -p gh-pages-out/latest
cp -r target/site/apidocs/. gh-pages-out/latest/ cp -r "$APIDOCS_DIR"/. gh-pages-out/latest/
- name: Regenerate index.html - name: Regenerate index.html
run: | run: |
@@ -329,4 +345,4 @@ jobs:
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A git add -A
git diff --cached --quiet || git commit -m "docs(javadoc): publish ${{ inputs.version }}" git diff --cached --quiet || git commit -m "docs(javadoc): publish ${{ inputs.version }}"
git push origin gh-pages git push origin gh-pages