1- # .github/workflows/site.yml
1+ # GitHub Pages deployment workflow
22name : site
33
44on :
77 tags-ignore : ['**']
88 pull_request :
99 schedule :
10- - cron : ' 0 10 * * 6' # Runs at 10:00 UTC every Saturday
10+ - cron : ' 0 10 * * 6' # Every Saturday at 10:00
1111
1212permissions :
1313 contents : read
@@ -28,13 +28,10 @@ jobs:
2828 - uses : actions/checkout@v4
2929 with :
3030 fetch-depth : 0
31-
3231 - uses : actions/setup-python@v4
3332 with :
3433 python-version : ' 3.11'
35-
3634 - run : pip install -r requirements.txt pyyaml
37-
3835 - name : Check CITATION.cff & .zenodo.json
3936 run : |
4037 python <<EOF
@@ -60,46 +57,34 @@ jobs:
6057 - uses : actions/checkout@v4
6158 with :
6259 fetch-depth : 0
63-
6460 - uses : actions/setup-python@v4
6561 with :
6662 python-version : ' 3.11'
67-
6863 - id : pages
6964 uses : actions/configure-pages@v3
70-
7165 - run : pip install -r requirements.txt
72-
73- - name : Jupyter Book Build
66+ - name : Build Jupyter Book
7467 run : |
7568 sudo apt update -qq
76- sudo apt install -qq ghostscript fonts-freefont-otf # Install necessary packages
77-
78- # Build the book in dirhtml format, treating warnings as errors
69+ sudo apt install -qq ghostscript fonts-freefont-otf
70+ sed -ri 's#^(\s*book_baseurl:).*#\1 ${{ steps.pages.outputs.base_url }}/$SITE_PREFIX#g' _config.yml
7971 jupyter-book build --builder dirhtml --warningiserror --nitpick --keep-going .
80-
81- # Fix canonical links to remove .html suffix
72+ # Fix canonical links
8273 sed -ri 's#(.*link rel="canonical" href=".*)\.html(".*)#\1/\2#' _build/dirhtml/*/index.html
83-
84- # Removed LaTeX build step to prevent 'book.tex' not found error
85-
74+ - uses : xu-cheng/latex-action@v3
75+ with :
76+ working_directory : _build/latex
77+ root_file : book.tex
78+ args : -pdf -dvi- -ps- -file-line-error -f -interaction=nonstopmode
79+ latexmk_use_xelatex : true
80+ env :
81+ XINDYOPTS : -L english -C utf8 -M sphinx.xdy
82+ continue-on-error : true
8683 - name : Prepare _site Pages
8784 run : |
8885 mkdir _site
8986 mv _build/dirhtml _site/$SITE_PREFIX
90-
91- # Create a minimal root redirect (optional)
92- echo '<!DOCTYPE html>
93- <html>
94- <head>
95- <meta http-equiv="refresh" content="0; url=https://book.premai.io/state-of-open-source-ai/">
96- <title>Redirecting…</title>
97- </head>
98- <body>
99- <p>Redirecting to <a href="https://book.premai.io/state-of-open-source-ai/">State of Open Source AI</a>.</p>
100- </body>
101- </html>' > _site/index.html
102-
87+ sed "s#DESTINATION#${{ steps.pages.outputs.base_url }}/$SITE_PREFIX#g" .redirect-template.html > _site/index.html
10388 - uses : actions/upload-pages-artifact@v2
10489
10590 deploy :
0 commit comments