3434 restore-keys : |
3535 latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-
3636 latex-apt-${{ runner.os }}-${{ runner.arch }}-
37+ lookup-only : true
3738
3839 - name : Download LaTeX packages (cache miss only)
3940 if : steps.cache-latex-apt.outputs.cache-hit != 'true'
4748 # Ensure downloaded packages are owned by the current user so they can be cached
4849 sudo chown -R $(id -u):$(id -g) ${{ runner.temp }}/.cache/archives
4950
51+ - name : Save LaTeX apt cache (cache miss only)
52+ if : steps.cache-latex-apt.outputs.cache-hit != 'true'
53+ uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
54+ with :
55+ path : ${{ runner.temp }}/.cache/archives
56+ key : latex-apt-${{ runner.os }}-${{ runner.arch }}-ubuntu-24.04-texlive-2023
57+
5058 build :
5159 name : Build ${{ matrix.manual.name }}
5260 runs-on : ubuntu-latest
@@ -121,6 +129,7 @@ jobs:
121129
122130 - name : Install LaTeX from cache
123131 if : ${{ matrix.manual.build_pdf_path }}
132+ timeout-minutes : 3
124133 run : |
125134 sudo DEBIAN_FRONTEND=noninteractive apt-get update
126135 sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
@@ -317,7 +326,7 @@ jobs:
317326 branch="${{ steps.branch.outputs.branch_name }}"
318327
319328 # Create the branch folder directly
320- mkdir -p "deploy-staging /${branch}"
329+ mkdir -p "stage /${branch}"
321330
322331 # Copy artifacts preserving their manual folder structure
323332 # Each artifact (user_manual, admin_manual, developer_manual) contains
@@ -326,20 +335,20 @@ jobs:
326335 if [ -d "$artifact" ]; then
327336 manual_name="$(basename "$artifact")"
328337 # Create the manual-specific folder
329- mkdir -p "deploy-staging /${branch}/${manual_name}"
338+ mkdir -p "stage /${branch}/${manual_name}"
330339 # Copy artifact contents into the manual folder
331- cp -r "$artifact/"* "deploy-staging /${branch}/${manual_name}/"
340+ cp -r "$artifact/"* "stage /${branch}/${manual_name}/"
332341 fi
333342 done
334343
335344 # Move PDF files to the root of the branch folder for cleaner structure
336- find "deploy-staging /${branch}/" -maxdepth 2 -name "*.pdf" -type f -exec mv {} "deploy-staging /${branch}/" \;
345+ find "stage /${branch}/" -maxdepth 2 -name "*.pdf" -type f -exec mv {} "stage /${branch}/" \;
337346
338347 # Clean up empty directories
339- find deploy-staging -type d -empty -delete
348+ find stage -type d -empty -delete
340349
341350 echo "Staged artifacts for ${branch}:"
342- find deploy-staging -type f | head -20
351+ find stage -type f | head -20
343352
344353 # ========================================================================
345354 # CACHE STAGING ARTIFACTS
@@ -350,7 +359,7 @@ jobs:
350359 - name : Cache staged artifacts
351360 uses : actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
352361 with :
353- path : deploy-staging /
362+ path : stage /
354363 key : staged-docs-${{ github.sha }}
355364
356365 # ============================================================================
@@ -446,20 +455,27 @@ jobs:
446455 echo "has_changes=true" >> $GITHUB_OUTPUT
447456 fi
448457
458+ # Remove the stage/ directory BEFORE creating the PR so it doesn't get committed
459+ - name : Clean up staging cache before commit
460+ run : rm -rf stage/
461+
449462 - name : Create Pull Request for documentation deployment
450463 uses : peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
451464 id : cpr
452465 if : steps.apply.outputs.has_changes == 'true'
453466 with :
454467 token : ${{ secrets.COMMAND_BOT_PAT }}
455- commit-message : " chore: update documentation for ${{ needs.stage-and-check.outputs.branch_name }}"
468+ commit-message : " chore: update documentation for ` ${{ needs.stage-and-check.outputs.branch_name }}` "
456469 committer : nextcloud-command <nextcloud-command@users.noreply.github.com>
457470 author : nextcloud-command <nextcloud-command@users.noreply.github.com>
458471 signoff : true
459472 branch : " automated/deploy/documentation-${{ needs.stage-and-check.outputs.branch_name }}"
460473 base : gh-pages
461- title : " Documentation update for ${{ needs.stage-and-check.outputs.branch_name }}"
462- body : " Automated documentation update from branch ${{ github.ref_name }}"
474+ title : " Documentation update for `${{ needs.stage-and-check.outputs.branch_name }}`"
475+ body : |
476+ This PR was automatically generated by the CI workflow and
477+ includes the latest changes for the `${{ needs.stage-and-check.outputs.branch_name }}` branch.
478+
463479 delete-branch : true
464480 labels : " automated, 3. to review"
465481
@@ -481,4 +497,13 @@ jobs:
481497
482498 steps :
483499 - name : Summary status
484- run : if ${{ needs.build.result != 'success' || needs.stage-and-check.result != 'success' || needs.deploy.result != 'success' }}; then exit 1; fi
500+ run : |
501+ if ${{ github.event_name == 'pull_request' }}
502+ then
503+ echo "This workflow ran for a pull request. We need build and stage-and-check to succeed, but deploy will be skipped"
504+ if ${{ needs.build.result != 'success' || needs.stage-and-check.result != 'success' || needs.deploy.result != 'skipped' }}; then exit 1; fi
505+ else
506+ echo "This workflow ran for a push. We need all jobs to succeed, including deploy"
507+ if ${{ needs.build.result != 'success' || needs.stage-and-check.result != 'success' || needs.deploy.result != 'success' }}; then exit 1; fi
508+ fi
509+
0 commit comments