This repository was archived by the owner on Jan 21, 2026. It is now read-only.
Build and publish book #362
This file contains hidden or 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 Typst | |
| uses: typst-community/setup-typst@v4 | |
| with: | |
| typst-version: ^0.14.0 | |
| - 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 | |
| sudo apt install -y fonts-ebgaramond | |
| - name: Install Scala and SBT | |
| uses: olafurpg/setup-scala@v11 | |
| with: | |
| java-version: adopt@1.11 | |
| - name: Generate book | |
| run: | | |
| mkdir -p dist | |
| sbt build | |
| - 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/actions-gh-pages@v3.8.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: site | |
| keep_files: true |