@@ -16,52 +16,51 @@ jobs:
1616 build-and-deploy-javadoc :
1717 runs-on : ubuntu-latest
1818 permissions :
19- contents : write
20- pages : write
21- id-token : write
19+ contents : write # Sufficient for checkout and pushing to gh-pages
2220
23- steps :
24- - name : Checkout Code at Specified Tag
25- uses : actions/checkout@v5
26- with :
27- ref : ${{ github.event.inputs.tag_ref }} # from manual trigger input
28- fetch-depth : 0
21+ steps :
22+ - name : Checkout Code at Specified Tag
23+ uses : actions/checkout@v5
24+ with :
25+ ref : ${{ github.event.inputs.tag_ref }} # from manual trigger input
26+ fetch-depth : 0
2927
30- - name : Set up JDK
31- uses : actions/setup-java@v4
32- with :
33- java-version : ' 25'
34- distribution : ' temurin'
35- cache : ' maven'
36-
37- - name : Build and Generate Javadoc
38- run : mvn javadoc:javadoc
39-
40- - name : Deploy Javadoc to gh-pages/docs/${TAG}
41- env :
42- 43- GH_PAGES_NAME : github-actions[bot]
44- GIT_TAG_NAME : ${{ github.event.inputs.tag_ref }}
45- TARGET_DIR : docs/${{ github.event.inputs.tag_ref }}
46- run : |
47- # 1. Configure Git user
48- git config user.email "${GH_PAGES_EMAIL}"
49- git config user.name "${GH_PAGES_NAME}"
50-
51- # 2. Fetch and checkout the existing gh-pages branch
52- git fetch origin gh-pages:gh-pages
53- git checkout gh-pages
54-
55- # 3. Clean up any previous documentation for this tag (optional, but safer)
56- rm -rf $TARGET_DIR
57-
58- # 4. Create the versioned directory structure
59- mkdir -p $TARGET_DIR
60-
61- # 5. Copy the generated Javadoc files into the versioned directory
62- cp -r target/reports/apidocs/* $TARGET_DIR/
63-
64- # 6. Add the new directory and files, commit, and push
65- git add $TARGET_DIR
66- git commit -m "Manual Javadoc deployment for tag ${GIT_TAG_NAME} into $TARGET_DIR"
67- git push origin gh-pages
28+ - name : Set up JDK
29+ uses : actions/setup-java@v4
30+ with :
31+ java-version : ' 25'
32+ distribution : ' temurin'
33+ cache : ' maven'
34+
35+ - name : Build and Generate Javadoc
36+ run : mvn javadoc:javadoc
37+
38+ - name : Deploy Javadoc to gh-pages/docs/${TAG}
39+ env :
40+ 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+
45+ 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
0 commit comments