Build and publish book #241
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
name: publish | |
run-name: Build and publish book | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v4 | |
- name: Download Java | |
uses: actions/setup-java@v4 | |
id: download-java | |
with: | |
distribution: "temurin" | |
java-version: 21 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.9.0" | |
cache: "npm" | |
- run: npm ci | |
# - name: Install TeX Live | |
# uses: zauguin/install-texlive@v2 | |
# with: | |
# packages: > | |
# l3build latex latex-bin luatex latex-bin-dev xetex mdframed amsmath listings xcolor fancyvrb kvoptions etoolbox booktabs hyperref zref infwarerr pdftexcmds iftex needspace | |
# MikTex automatically installs the latex packages that are needed by the document | |
- name: Setup MikTex | |
run: | | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D6BC243565B2087BC3F897C9277A7293F59E4889 | |
echo "deb http://miktex.org/download/ubuntu jammy universe" | sudo tee /etc/apt/sources.list.d/miktex.list | |
sudo apt-get update | |
sudo apt-get install miktex | |
sudo miktexsetup --shared=yes finish | |
sudo initexmf --admin --set-config-value [MPM]AutoInstall=yes | |
- name: Setup Pandoc | |
run: | | |
curl -Ls https://github.com/jgm/pandoc/releases/download/3.1.11/pandoc-3.1.11-linux-amd64.tar.gz > /tmp/pandoc.tgz | |
tar zxvf /tmp/pandoc.tgz | |
mv pandoc-3.1.11/bin/pandoc /usr/local/bin/pandoc | |
curl -Ls https://github.com/lierdakil/pandoc-crossref/releases/download/v0.3.17.0b/pandoc-crossref-Linux.tar.xz > /tmp/pandoc-crossref.tgz | |
tar xvf /tmp/pandoc-crossref.tgz | |
mv pandoc-crossref /usr/local/bin/pandoc-crossref | |
- name: Cache sbt | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.sbt | |
~/.ivy2/cache | |
~/.coursier/cache/v1 | |
~/.cache/coursier/v1 | |
~/AppData/Local/Coursier/Cache/v1 | |
~/Library/Caches/Coursier/v1 | |
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} | |
- name: Install Fonts | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y ttf-bitstream-vera | |
- name: Generate book | |
run: sbt all | |
- name: Copy book to site | |
run: | | |
mv dist/* site/dist | |
- name: Publish site | |
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/develop' | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: site | |
keep_files: true |