| name: Stage Versioned Javadocs (Manual Trigger) | |
| # This workflow is triggered manually via Workflow Dispatch on GitHub. | |
| # It automatically extracts the project version from the root pom.xml | |
| # of the branch or tag that you trigger this workflow from. | |
| # It compiles and packages the javadocs into a structured ZIP. | |
| # | |
| # To deploy: | |
| # 1. Kick off the workflow on your chosen branch or tag. | |
| # 2. Download the resulting versioned-javadocs-*.zip from the run summary. | |
| # 3. You have 30 days to download before they are deleted from the server. | |
| # 4. Extract it directly into your local gh-pages repository clone and push. | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-and-package-javadoc: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: 1. Checkout Current (triggered) Workspace Context | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.ref }} | |
| fetch-depth: 0 | |
| - name: 2. Provision JDK 25 Runtime | |
| uses: actions/setup-java@v6 | |
| with: | |
| java-version: '25' | |
| distribution: 'temurin' | |
| java-package: jdk | |
| architecture: x64 | |
| cache: 'maven' | |
| - name: 3. Extract POM Project Version | |
| id: get-version | |
| shell: bash | |
| run: | | |
| POM_VERSION=$(mvn help:evaluate -B -Dexpression=project.version -q -DforceStdout) | |
| echo "Discovered Project Version: $POM_VERSION" | |
| echo "POM_VERSION=$POM_VERSION" >> $GITHUB_ENV | |
| - name: 4. Compile and Generate Javadoc | |
| shell: bash | |
| run: | | |
| echo "Generating Javadoc..." | |
| mvn clean compile javadoc:javadoc -B | |
| - name: 5. Stage Artifacts for Review | |
| shell: bash | |
| run: | | |
| STAGE_DIR="javadoc-staging/docs/${{ env.POM_VERSION }}" | |
| echo "Creating staging directory for version ${{ env.POM_VERSION }}..." | |
| mkdir -p "${STAGE_DIR}" | |
| echo "Copying generated HTML assets into staging..." | |
| cp -r target/site/apidocs/* "${STAGE_DIR}/" | |
| - name: 6. Upload Generated Javadocs as Workflow Zip Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: versioned-javadocs-${{ env.POM_VERSION }} | |
| path: javadoc-staging/ | |
| retention-days: 30 |