Skip to content

Build and publish book #353

Build and publish book

Build and publish book #353

Workflow file for this run

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
- name: Install Scala and SBT
uses: olafurpg/setup-scala@v11
with:
java-version: adopt@1.11
- name: Generate book
run: 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