This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch fix_javadoc_yml_2
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git

commit 592c85b5ae3830384f8c944084fa40f02659b79c
Author: Lee Rhodes <[email protected]>
AuthorDate: Mon Jan 5 18:07:42 2026 -0800

    fix javadocs-yml 2, add manual script.
---
 .github/workflows/javadoc.yml | 17 ++++++++++++-----
 tools/ManualJavadocsDeploy.sh | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml
index 401cda867..eb68e1619 100644
--- a/.github/workflows/javadoc.yml
+++ b/.github/workflows/javadoc.yml
@@ -3,6 +3,7 @@ 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.
+# The gh-pages/docs branch/folder must exist.
 
 on:
   workflow_dispatch:
@@ -47,25 +48,31 @@ jobs:
           git config user.name "github-actions[bot]"
           
           # 3. Ensure gh-pages exists and is fetched
-          git fetch origin gh-pages --depth=1 || git branch gh-pages
+          echo "git fetch origin gh-pages"
+          git fetch origin gh-pages
           
           # 4. Create worktree for the gh-pages branch in a separate folder
+          echo "git worktree add ./gh-pages-dir origin/gh-pages"
           git worktree add ./gh-pages-dir origin/gh-pages
           
           # 5. Deployment Logic in a subshell to capture exit code
           (
-            set -e # Exit subshell on any internal error
-            TARGET_PATH="gh-pages-dir/docs/$TAG_NAME" # target directory 
inside the worktree
+            set -e
+            TARGET_PATH="gh-pages-dir/docs/$TAG_NAME"
             mkdir -p "$TARGET_PATH"
+            echo "cp -a target/site/apidocs/. $TARGET_PATH/"
             cp -a target/site/apidocs/. "$TARGET_PATH/"
-            
             cd gh-pages-dir
-            git add .
+            echo "git add docs/$TAG_NAME"
+            git add "docs/$TAG_NAME"
             
             if git diff --staged --quiet; then
               echo "No changes detected for Javadoc $TAG_NAME."
             else
+              echo "Changes detected for Javadoc $TAG_NAME."
+              echo "git commit ..."
               git commit -m "Manual Javadoc deployment for tag $TAG_NAME"
+              echo "git push origin gh-pages"
               git push origin gh-pages
             fi
           ) || EXIT_CODE=$?
diff --git a/tools/ManualJavadocsDeploy.sh b/tools/ManualJavadocsDeploy.sh
new file mode 100755
index 000000000..e0b991885
--- /dev/null
+++ b/tools/ManualJavadocsDeploy.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+set -e
+
+TAG_NAME="test"
+# Build and Generate Javadoc
+# POM is configured to output to target/site/apidocs
+echo "mvn clean javadoc:javadoc"
+mvn clean javadoc:javadoc
+
+echo "git fetch origin gh-pages"
+git fetch origin gh-pages
+
+echo "Create worktree"
+git worktree add ./gh-pages-dir origin/gh-pages
+EXIT_CODE=0
+(
+  set -e
+  TARGET_PATH="gh-pages-dir/docs/$TAG_NAME"
+  mkdir -p "$TARGET_PATH"
+  cp -a target/site/apidocs/. "$TARGET_PATH/"
+  cd gh-pages-dir
+  git add "docs/$TAG_NAME"
+  
+  if git diff --staged --quiet; then
+    echo "No changes detected for Javadoc $TAG_NAME."
+  else
+    echo "Changes detected for Javadoc $TAG_NAME."
+    git status
+    git commit -m "Manual Javadoc deployment for tag $TAG_NAME"
+    git push origin gh-pages
+  fi
+) || EXIT_CODE=$?
+
+# Cleanup
+echo "Cleaning up worktree..."
+git worktree remove --force ./gh-pages-dir || true
+
+# Final exit based on subshell success
+exit $EXIT_CODE
+if: success()
+run: echo "Javadoc for $TAG_NAME is now live on gh-pages."
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to