Skip to content

Update pom and try to fix javadoc.yml #176

Update pom and try to fix javadoc.yml

Update pom and try to fix javadoc.yml #176

Workflow file for this run

name: Deploy Versioned Javadoc (Manual Trigger)
# Select the target TAG where to run the workflow from.
# This TAG name becomes the subdirectory under branch gh-pages/docs/${TAG}
# where the javadocs will be copied to.
on:
workflow_dispatch:
inputs:
tag_ref:
description: 'Existing Git Tag to deploy (e.g., 1.0.0):'
required: true
# Default can be left blank or set to a placeholder
default: '99.0.0' # unlikely to conflict if accidentally used.
jobs:
build-and-deploy-javadoc:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code at Specified Tag
uses: actions/checkout@v5
with:
ref: ${{ github.event.inputs.tag_ref }} # from manual trigger input
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
cache: 'maven'
- name: Build and Generate Javadoc
# POM is configured to output to target/site/apidocs
run: mvn javadoc:javadoc

Check failure on line 39 in .github/workflows/javadoc.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/javadoc.yml

Invalid workflow file

You have an error in your yaml syntax on line 39
- name: Deploy Javadoc via Worktree
env:
TAG_NAME: ${{ github.event.inputs.tag_ref }}
run: |
# 1. Configure Git Identity
git config user.email "noreply@github.com"
git config user.name "github-actions[bot]"
# 2. Ensure gh-pages exists and is fetched
git fetch origin gh-pages --depth=1 || git branch gh-pages
# 3. Create a worktree for the gh-pages branch in a separate folder
# This prevents switching the main directory and losing the 'target' folder
git worktree add ./gh-pages-dir origin/gh-pages
# 4. Prepare the target directory inside the worktree
TARGET_PATH="gh-pages-dir/docs/$TAG_NAME"
mkdir -p $TARGET_PATH
# 5. Copy the generated docs (using . to copy contents, not the folder itself)
cp -a target/site/apidocs/. $TARGET_PATH/
# 6. Commit and Push from the worktree directory
cd gh-pages-dir
git add .
# Only commit and push if there are actual changes
if git diff --staged --quiet; then
echo "No changes detected for Javadoc $TAG_NAME."
else
git commit -m "Manual Javadoc deployment for tag $TAG_NAME"
git push origin gh-pages
fi
# 7. Cleanup the worktree
cd ..
git worktree remove ./gh-pages-dir