Skip to content

Commit 6acf50c

Browse files
authored
Merge pull request #705 from apache/fix_array_of_strings_summary
Fix ArrayOfStringsSummary and add .mvn to root.
2 parents b1d07af + 175ee15 commit 6acf50c

File tree

7 files changed

+376
-334
lines changed

7 files changed

+376
-334
lines changed

.github/workflows/javadoc.yml

Lines changed: 50 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88
workflow_dispatch:
99
inputs:
1010
tag_ref:
11-
description: 'Existing Git Tag to deploy (e.g., 1.0.0)'
11+
description: 'Existing Git Tag to deploy (e.g., 1.0.0):'
1212
required: true
13-
default: '1.0.0' # Default can be left blank or set to a placeholder
13+
default: '99.0.0' # unlikely to conflict if accidentally used. Can be left blank
1414

1515
jobs:
1616
build-and-deploy-javadoc:
1717
runs-on: ubuntu-latest
1818
permissions:
19-
contents: write # Sufficient for checkout and pushing to gh-pages
19+
contents: write
2020

2121
steps:
2222
- name: Checkout Code at Specified Tag
@@ -30,37 +30,53 @@ jobs:
3030
with:
3131
java-version: '25'
3232
distribution: 'temurin'
33-
cache: 'maven'
34-
35-
- name: Build and Generate Javadoc
33+
cache: 'maven'
34+
35+
- name: Build and Generate Javadoc # POM is configured to output to target/site/apidocs
3636
run: mvn javadoc:javadoc
37-
38-
- name: Deploy Javadoc to gh-pages/docs/${TAG}
37+
38+
- name: Deploy Javadoc via Worktree
3939
env:
40-
GH_PAGES_EMAIL: noreply@github.com
41-
GH_PAGES_NAME: github-actions[bot]
42-
GIT_TAG_NAME: ${{ github.event.inputs.tag_ref }}
43-
TARGET_DIR: docs/${{ github.event.inputs.tag_ref }}
44-
40+
TAG_NAME: ${{ github.event.inputs.tag_ref }}
4541
run: |
46-
# 1. Configure Git user
47-
git config user.email "${GH_PAGES_EMAIL}"
48-
git config user.name "${GH_PAGES_NAME}"
49-
50-
# 2. Fetch and checkout the existing gh-pages branch (or create it if it doesn't exist)
51-
git fetch origin gh-pages:gh-pages
52-
git checkout gh-pages
53-
54-
# 3. Clean up any previous documentation for this tag (optional, but safer)
55-
rm -rf $TARGET_DIR
56-
57-
# 4. Create the versioned directory structure
58-
mkdir -p $TARGET_DIR
59-
60-
# 5. Copy the generated Javadoc files into the versioned directory
61-
cp -r target/reports/apidocs/* $TARGET_DIR/
62-
63-
# 6. Add the new directory and files, commit, and push
64-
git add $TARGET_DIR
65-
git commit -m "Manual Javadoc deployment for tag ${GIT_TAG_NAME} into $TARGET_DIR"
66-
git push origin gh-pages
42+
# 1. Initialize error tracking
43+
EXIT_CODE=0
44+
45+
# 2. Configure Git Identity
46+
git config user.email "noreply@github.com"
47+
git config user.name "github-actions[bot]"
48+
49+
# 3. Ensure gh-pages exists and is fetched
50+
git fetch origin gh-pages --depth=1 || git branch gh-pages
51+
52+
# 4. Create worktree for the gh-pages branch in a separate folder
53+
git worktree add ./gh-pages-dir origin/gh-pages
54+
55+
# 5. Deployment Logic in a subshell to capture exit code
56+
(
57+
set -e # Exit subshell on any internal error
58+
TARGET_PATH="gh-pages-dir/docs/$TAG_NAME" # target directory inside the worktree
59+
mkdir -p "$TARGET_PATH"
60+
cp -a target/site/apidocs/. "$TARGET_PATH/"
61+
62+
cd gh-pages-dir
63+
git add .
64+
65+
if git diff --staged --quiet; then
66+
echo "No changes detected for Javadoc $TAG_NAME."
67+
else
68+
git commit -m "Manual Javadoc deployment for tag $TAG_NAME"
69+
git push origin gh-pages
70+
fi
71+
) || EXIT_CODE=$?
72+
73+
# 6. Cleanup (Always runs)
74+
echo "Cleaning up worktree..."
75+
git worktree remove --force ./gh-pages-dir || true
76+
77+
# 7. Final exit based on subshell success
78+
exit $EXIT_CODE
79+
80+
- name: Confirm Deployment
81+
if: success()
82+
run: echo "Javadoc for ${{ github.event.inputs.tag_ref }} is now live on gh-pages."

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# Additional tools
1717
.clover/
18+
.mvn/
1819

1920
# OSX files
2021
**/.DS_Store

.mvn/maven.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# suppresses the warning:
2+
# Direct modification of testCompileSourceRoots through add() is deprecated and will not work in Maven 4.0.0. Please use the add/remove methods instead.
3+
# If you're using a plugin that causes this warning, please upgrade to the latest version and report an issue if the warning persists.
4+
# To disable these warnings, set -Dmaven.project.sourceRoots.warningsDisabled=true on the command line, in the .mvn/maven.config file,
5+
# or in project POM properties.
6+
-Dmaven.project.sourceRoots.warningsDisabled=true

0 commit comments

Comments
 (0)