11# Workflow for deploying versioned documentation to GitHub Pages.
2- # Source code is built from the monorepo (github/copilot-sdk) at a release tag .
3- # The generated site is deployed to this repo's gh-pages branch .
2+ # Site content (src/site/, pom.xml) lives in THIS repo .
3+ # Java source code is checked out from the monorepo (github/copilot-sdk) at a release tag .
44name : Deploy Documentation
55
66on :
@@ -35,13 +35,11 @@ jobs:
3535 name : github-pages
3636 url : ${{ steps.deployment.outputs.page_url }}
3737 steps :
38- # 1. Checkout this (standalone) repo for templates and workflow files
38+ # 1. Checkout this (standalone) repo — has src/site/, pom.xml, templates
3939 - name : Checkout standalone repo
4040 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
41- with :
42- path : standalone
4341
44- # 2. Checkout the monorepo at the release tag (for Java source + site content )
42+ # 2. Checkout the monorepo at the release tag (for Java source code )
4543 - name : Checkout monorepo at release tag
4644 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4745 with :
@@ -58,14 +56,20 @@ jobs:
5856 distribution : ' microsoft'
5957 cache : ' maven'
6058
61- # 4. Build the Maven Site from monorepo java/ directory
62- - name : Build documentation site
59+ # 4. Compile monorepo Java source (needed for javadoc, SpotBugs, etc.)
60+ - name : Compile monorepo Java source
6361 working-directory : monorepo/java
6462 run : |
65- echo "Building site for version ${{ inputs.version }} from tag ${{ inputs.monorepo_tag }}"
66- mvn clean compile site -DskipTests -Dcheckstyle.skip=true -B
63+ echo "Compiling Java source from tag ${{ inputs.monorepo_tag }}"
64+ mvn clean compile test -DskipTests=false -Dcheckstyle.skip=true -B
65+
66+ # 5. Build the Maven Site using THIS repo's pom.xml + src/site/
67+ - name : Build documentation site
68+ run : |
69+ echo "Building site for version ${{ inputs.version }}"
70+ mvn site -Dsite.version=${{ inputs.version }} -B
6771
68- # 5 . Checkout gh-pages branch from this (standalone) repo
72+ # 6 . Checkout gh-pages branch from this (standalone) repo
6973 - name : Checkout gh-pages branch
7074 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7175 with :
@@ -84,42 +88,37 @@ jobs:
8488 git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
8589 fi
8690
87- # 6 . Copy generated site to version directory
91+ # 7 . Copy generated site to version directory
8892 - name : Deploy version documentation
8993 run : |
9094 VERSION="${{ inputs.version }}"
9195 echo "Deploying documentation for version ${VERSION}"
9296
9397 rm -rf "site/${VERSION}"
9498 mkdir -p "site/${VERSION}"
95- cp -r monorepo/java/ target/site/* "site/${VERSION}/"
99+ cp -r target/site/* "site/${VERSION}/"
96100
97101 # Also publish as /latest/ if requested
98102 if [[ "${{ inputs.publish_as_latest }}" == "true" ]]; then
99103 rm -rf "site/latest"
100104 mkdir -p "site/latest"
101- cp -r monorepo/java/ target/site/* "site/latest/"
105+ cp -r target/site/* "site/latest/"
102106 fi
103107
104- # 7 . Copy version index page from standalone templates
108+ # 8 . Copy version index page from templates
105109 - name : Copy version index page
106110 run : |
107- cp standalone/ .github/templates/index.html site/index.html
108- cp standalone/ .github/templates/styles.css site/styles.css
111+ cp .github/templates/index.html site/index.html
112+ cp .github/templates/styles.css site/styles.css
109113
110- # 8. Update version list based on directories present in gh-pages
111- # (NOT from tags — tags do not exist in this repo)
114+ # 9. Update version list based on directories present in gh-pages
112115 - name : Update version list from deployed directories
113116 run : |
114117 cd site
115118
116- # Release notes for OLD versions (pre-monorepo) are in the standalone repo.
117- # Release notes for NEW versions (monorepo era) are in the monorepo.
118119 MONOREPO_URL="https://github.com/github/copilot-sdk"
119120 STANDALONE_URL="https://github.com/github/copilot-sdk-java"
120121
121- # Detect versions from directories that exist in gh-pages.
122- # Exclude non-version dirs: snapshot, latest, .git, etc.
123122 VERSIONS=$(ls -d */ 2>/dev/null | sed 's|/||' | grep -E '^[0-9]+\.[0-9]+' | sort -Vr || true)
124123
125124 HAS_SNAPSHOT=$([ -d "snapshot" ] && echo "true" || echo "false")
@@ -128,19 +127,11 @@ jobs:
128127 OLDER_HTML=""
129128 IS_FIRST_VERSION="true"
130129
131- # Add snapshot if exists
132130 if [ "$HAS_SNAPSHOT" = "true" ]; then
133131 CURRENT_HTML+='<li><span class="version-name">Development (main branch)</span><span class="version-links"><a href="./snapshot/" class="doc-link">documentation ↗</a><a href="'"${MONOREPO_URL}"'/blob/main/java/CHANGELOG.md" class="release-link">changelog ↗</a><span class="badge snapshot">snapshot</span></span></li>'
134132 fi
135133
136- # Add versioned releases — directory-based, no tags needed
137134 for v in $VERSIONS; do
138- # Determine which repo has the release notes for this version.
139- # Monorepo tags use "java/v{VERSION}" format.
140- # Check if a monorepo-era release exists. Heuristic: if the version
141- # was just deployed by this workflow, it's a monorepo release.
142- # For simplicity, try monorepo first; old standalone releases
143- # will still work via their existing links.
144135 RELEASE_URL="${MONOREPO_URL}/releases/tag/java/v${v}"
145136
146137 if [ "$IS_FIRST_VERSION" = "true" ]; then
@@ -154,11 +145,11 @@ jobs:
154145 sed -i "s|<!-- CURRENT_VERSIONS_PLACEHOLDER -->|$CURRENT_HTML|" index.html
155146 sed -i "s|<!-- OLDER_VERSIONS_PLACEHOLDER -->|$OLDER_HTML|" index.html
156147
157- # 9 . Overlay custom JaCoCo CSS (from the monorepo's site resources)
148+ # 10 . Overlay custom JaCoCo CSS
158149 - name : Overlay custom JaCoCo CSS
159150 run : |
160151 cd site
161- JACOCO_CSS="../monorepo/java/ src/site/jacoco-resources/report.css"
152+ JACOCO_CSS="../src/site/jacoco-resources/report.css"
162153 if [ -f "${JACOCO_CSS}" ]; then
163154 for dir in */jacoco/jacoco-resources; do
164155 if [ -d "$dir" ]; then
@@ -168,7 +159,7 @@ jobs:
168159 done
169160 fi
170161
171- # 10 . Push to gh-pages
162+ # 11 . Push to gh-pages
172163 - name : Deploy to GitHub Pages
173164 run : |
174165 cd site
0 commit comments