drop contrib svg #393
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml | |
name: site | |
on: | |
push: | |
workflow_dispatch: | |
permissions: | |
# allow GITHUB_TOKEN to deploy to GitHub Pages | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: {group: "${{ github.ref }}-pages", cancel-in-progress: true} | |
env: | |
SITE_PREFIX: state-of-open-source-ai | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: {fetch-depth: 0} | |
- uses: actions/setup-python@v4 | |
with: {python-version: '3.x'} | |
- id: pages | |
uses: actions/configure-pages@v3 | |
- run: pip install -r requirements.txt | |
- name: jupyter-book build | |
run: | | |
sudo apt install -qq ghostscript fonts-freefont-otf # https://stackoverflow.com/a/69012150 | |
sed -ri 's#^(\s*baseurl:).*#\1 ${{ steps.pages.outputs.base_url }}/'$SITE_PREFIX'#g' _config.yml | |
jupyter-book build --builder latex --warningiserror --nitpick --keep-going . | |
# insert PDF cover | |
cd _build/latex | |
curl -fsSLO https://static.premai.io/book/cover.pdf | |
sed -i -r \ | |
-e 's/(\\documentclass.*)letterpaper(.*)/\1a4paper\2/' \ | |
-e 's/(\\usepackage\{geometry\})/\1\n\\usepackage\{pdfpages\}/' \ | |
-e 's/\\sphinxmaketitle/\\includepdf\[pages=-\]\{cover.pdf\}/' \ | |
-e 's/\\sphinxtableofcontents//' \ | |
book.tex | |
env: {PYTHONPATH: .} | |
- uses: xu-cheng/latex-action@v3 | |
with: | |
working_directory: _build/latex | |
root_file: book.tex | |
args: -pdf -dvi- -ps- -file-line-error -f -interaction=nonstopmode | |
latexmk_use_xelatex: true | |
env: | |
XINDYOPTS: -L english -C utf8 -M sphinx.xdy | |
- name: prepare _site pages | |
run: | | |
mkdir _site | |
mv _build/dirhtml _site/$SITE_PREFIX | |
mv _build/latex/book.pdf _site/$SITE_PREFIX.pdf | |
sed "s#DESTINATION#${{ steps.pages.outputs.base_url }}/$SITE_PREFIX#g" .redirect-template.html > _site/index.html | |
- uses: actions/upload-pages-artifact@v2 |