@@ -103,20 +103,8 @@ jobs:
103103 run : pip install -r requirements.txt
104104
105105 - name : Build html documentation
106- env :
107- SPHINXOPTS : " -W --keep-going"
108106 run : cd ${{ matrix.manual.directory }} && make ${{ matrix.manual.make_target }}
109107
110- - name : Compute release version
111- id : release_version
112- run : |
113- branch="${GITHUB_REF#refs/heads/}"
114- if [[ "$branch" == stable* ]]; then
115- echo "release=${branch#stable}" >> $GITHUB_OUTPUT
116- else
117- echo "release=latest" >> $GITHUB_OUTPUT
118- fi
119-
120108 - name : Compute PDF release version
121109 if : ${{ matrix.manual.build_pdf_path }}
122110 id : pdf_version
@@ -175,7 +163,7 @@ jobs:
175163 fetch-depth : 0
176164 token : ${{ secrets.COMMAND_BOT_PAT }}
177165
178- - name : Download all build artifacts
166+ - name : Download all ${{ needs. build.outputs.branch_name }} artifacts
179167 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
180168 with :
181169 path : artifacts/
@@ -185,58 +173,74 @@ jobs:
185173 run : |
186174 current_branch="${GITHUB_REF#refs/heads/}"
187175
176+ # Find the highest numbered stable branch from the remote
188177 highest_stable=$(git ls-remote --heads origin | sed -n 's?.*refs/heads/stable\([0-9]\{2\}\)$?\1?p' | sort -n | tail -1)
189178 highest_stable_branch="stable${highest_stable}"
190179
191180 echo "Current branch: $current_branch"
192181 echo "Highest stable branch found: $highest_stable_branch"
193182
183+ # Map actual branch names to deployment folder names
194184 case "$current_branch" in
195185 "master")
196186 echo "branch_name=latest" >> $GITHUB_OUTPUT
197187 ;;
198188 "$highest_stable_branch")
199189 echo "branch_name=stable" >> $GITHUB_OUTPUT
190+ # Also record the numeric version so we can publish to server/<number>/ too
200191 echo "version_name=${highest_stable}" >> $GITHUB_OUTPUT
201192 ;;
202193 *)
194+ # Remove stable prefix for current branch
203195 current_branch="${current_branch#stable}"
204196 echo "branch_name=$current_branch" >> $GITHUB_OUTPUT
205197 ;;
206198 esac
207199
208- - name : Merge artifacts into gh-pages layout
200+ echo "Deployment folder name: ${{ steps.branch.outputs.branch_name }}"
201+ echo "Version name for additional deployment (if applicable): ${{ steps.branch.outputs.version_name }}"
202+
203+ - name : Merge ${{ steps.branch.outputs.branch_name }} documentation artifacts into gh-pages
209204 run : |
205+ # List artifacts
210206 ls -la artifacts/*/
211207
208+ # Cleanup old documentation
209+ rm -rf ${{ steps.branch.outputs.branch_name }}
212210 rm -rf server/${{ steps.branch.outputs.branch_name }}
213211 mkdir -p server/${{ steps.branch.outputs.branch_name }}
214212
213+ # Copy all built documentation into dedicated subdirectories
215214 for artifact in artifacts/*; do
216215 if [ -d "$artifact" ]; then
217216 manual_name="$(basename "$artifact")"
218- mkdir -p "server/${{ steps.branch.outputs.branch_name }}/$manual_name"
219- cp -r "$artifact/"* "server/${{ steps.branch.outputs.branch_name }}/$manual_name/"
220217 fi
221218 done
222219
220+ # Move pdf files to the root of the branch_name
223221 mv server/${{ steps.branch.outputs.branch_name }}/*/*.pdf server/${{ steps.branch.outputs.branch_name }}/ || true
224222
223+ # If this is the highest stable branch, also deploy to its versioned folder
225224 if [ -n "${{ steps.branch.outputs.version_name }}" ]; then
225+ rm -rf server/${{ steps.branch.outputs.version_name }}
226226 cp -r server/${{ steps.branch.outputs.branch_name }} server/${{ steps.branch.outputs.version_name }}
227227 fi
228228
229+ # Cleanup
229230 find . -type d -empty -delete
230231 rm -rf artifacts
231232
232233 - name : Add various redirects for go.php and user_manual english version
233234 run : |
235+ # Fetch source branches so git checkout origin/... works from the gh-pages checkout
234236 git fetch origin ${{ github.event.repository.default_branch }} ${{ github.ref_name }}
235237
238+ # Generate go.php redirect from main branch
236239 git checkout origin/${{ github.event.repository.default_branch }} -- go.php/index.html
237240 mkdir -p server/${{ steps.branch.outputs.branch_name }}/go.php
238241 mv go.php/index.html server/${{ steps.branch.outputs.branch_name }}/go.php/index.html
239242
243+ # Generate user_manual english redirect
240244 git checkout origin/${{ github.ref_name }} -- user_manual/index.html
241245 mkdir -p server/${{ steps.branch.outputs.branch_name }}/user_manual
242246 mv user_manual/index.html server/${{ steps.branch.outputs.branch_name }}/user_manual/index.html
0 commit comments