-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (63 loc) · 2.26 KB
/
Copy pathsphinx-docs.yml
File metadata and controls
80 lines (63 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build and Deploy Sphinx Docs
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
sphinx:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs-sphinx/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Sphinx and extensions
run: pip install -r docs-sphinx/requirements.txt
- name: Build Sphinx HTML
run: |
cd docs-sphinx
make html
# Install WeasyPrint + BeautifulSoup4 for the PDF build script.
# WeasyPrint needs Pango for font rendering on Ubuntu.
- name: Install PDF dependencies
run: |
sudo apt-get install -y libpango-1.0-0 libpangoft2-1.0-0
pip install weasyprint beautifulsoup4
# build_pdf.py reads all Sphinx HTML pages in toctree order,
# concatenates them into one document, and renders a multi-page
# PDF with internal hyperlinks and page numbers.
- name: Build multi-page PDF
run: python3 docs-sphinx/build_pdf.py
- name: Assemble deployment directory
run: |
mkdir -p deploy/sphinx
touch deploy/.nojekyll
# Landing page — plain committed HTML, easy to read and edit
cp docs-sphinx/index.html deploy/index.html
# Sphinx HTML portal
cp -r docs-sphinx/_build/html/. deploy/sphinx/
# Multi-page PDF (all chapters, internal links, page numbers)
cp docs-sphinx/_build/SpringBootLibrarySphinx.pdf \
deploy/sphinx/SpringBootLibrarySphinx.pdf
echo "PDF size: $(du -sh deploy/sphinx/SpringBootLibrarySphinx.pdf)"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
destination_dir: .
keep_files: true
enable_jekyll: false