1616 # builds and fail on any warnings.
1717 # SPHINXOPTS: "-W --keep-going -T"
1818 GENERATE_PDF : true # to enable, must be 'true' lowercase
19+ GENERATE_EPUB : true # to enable, must be 'true' lowercase
1920 GENERATE_SINGLEHTML : true # to enable, must be 'true' lowercase
20- PDF_FILENAME : lesson. pdf
21+ OUTPUT_BASENAME : ${{ github.repository_owner }}-${{ github.event.repository.name }} # used for pdf, epub
2122 MULTIBRANCH : true # to enable, must be 'true' lowercase
2223
2324
@@ -30,17 +31,17 @@ jobs:
3031
3132 steps :
3233 # https://github.com/marketplace/actions/checkout
33- - uses : actions/checkout@v4
34+ - uses : actions/checkout@v6
3435 with :
3536 fetch-depth : 0
3637 lfs : true
3738
3839 # https://github.com/marketplace/actions/setup-python
3940 # ^-- This gives info on matrix testing.
4041 - name : Install Python
41- uses : actions/setup-python@v4
42+ uses : actions/setup-python@v6
4243 with :
43- python-version : ' 3.11 '
44+ python-version : ' 3.13 '
4445 cache : ' pip'
4546
4647 # https://docs.github.com/en/actions/guides/building-and-testing-python#installing-dependencies
7374 pip list --not-required
7475 pip list
7576
77+ - name : Make target pub directory (_gh-pages)
78+ run :
79+ mkdir _gh-pages/
7680
7781 # Build
7882 - uses : ammaraskar/sphinx-problem-matcher@master
@@ -88,29 +92,30 @@ jobs:
8892 # https://github.com/sphinx-doc/sphinx/pull/8524
8993 # https://github.com/readthedocs/sphinx_rtd_theme/pull/1025
9094 sed -i 's/url_root="#"/url_root=""/' _build/dirhtml/index.html || true
95+ rsync -a _build/dirhtml/ _gh-pages/
9196
92- # singlehtml
97+ # singlehtml if requested
9398 - name : Generate singlehtml
9499 if : ${{ env.GENERATE_SINGLEHTML == 'true' }}
95100 run : |
96101 make singlehtml
97- mv _build/singlehtml/ _build/dirhtml/singlehtml/
102+ mv _build/singlehtml _gh_pages/singlehtml
103+
104+ # epub if requested
105+ - name : Generate epub
106+ if : ${{ env.GENERATE_EPUB == 'true' }}
107+ run : |
108+ make epub
109+ mv _build/eppub/*.epub _gh-pages/${OUTPUT_BASENAME}.epub
98110
99111 # PDF if requested
100112 - name : Generate PDF
101113 if : ${{ env.GENERATE_PDF == 'true' }}
102114 run : |
103115 #pip install https://github.com/rkdarst/sphinx_pyppeteer_builder/archive/refs/heads/main.zip
104116 pip install sphinx_pyppeteer_builder
105- make pyppeteer
106- mv _build/pyppeteer/*.pdf _build/dirhtml/${PDF_FILENAME}
107-
108- # Stage all deployed assets in _gh-pages/ for simplicity, and to
109- # prepare to do a multi-branch deployment.
110- - name : Copy deployment data to _gh-pages/
111- if : ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
112- run :
113- rsync -a _build/dirhtml/ _gh-pages/
117+ make SPHINXOPTS="-t pdf" pyppeteer
118+ mv _build/pyppeteer/*.pdf _gh-pages/${OUTPUT_BASENAME}.pdf
114119
115120 # Use gh-pages-multibranch to multiplex different branches into
116121 # one deployment. See
@@ -130,7 +135,7 @@ jobs:
130135 touch _gh-pages/.nojekyll
131136
132137 # Save artifact for the next step.
133- - uses : actions/upload-artifact@v4
138+ - uses : actions/upload-artifact@v6
134139 if : ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
135140 with :
136141 name : gh-pages-build
@@ -148,7 +153,7 @@ jobs:
148153 contents : write
149154
150155 steps :
151- - uses : actions/download-artifact@v4
156+ - uses : actions/download-artifact@v6
152157 if : ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && ( env.MULTIBRANCH == 'true' || github.ref == format('refs/heads/{0}', env.DEFAULT_BRANCH )) }}
153158 with :
154159 name : gh-pages-build
@@ -162,7 +167,7 @@ jobs:
162167 # Deploy
163168 # https://github.com/peaceiris/actions-gh-pages
164169 - name : Deploy
165- uses : peaceiris/actions-gh-pages@v3
170+ uses : peaceiris/actions-gh-pages@v4
166171 if : ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && ( env.MULTIBRANCH == 'true' || github.ref == format('refs/heads/{0}', env.DEFAULT_BRANCH )) }}
167172 with :
168173 publish_branch : gh-pages
0 commit comments