Skip to content

Commit 4b78eaf

Browse files
authored
Add GitHub Actions workflow for Quarto book build
1 parent f1ddaa1 commit 4b78eaf

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/build_book2.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build and Deploy Quarto Book
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
schedule:
10+
- cron: "0 23 * * *" # run every day at 11 PM UTC
11+
12+
env:
13+
RUST_BACKTRACE: 1
14+
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Set up Python
28+
uses: actions/setup-python@v5
29+
with:
30+
python-version: "3.11"
31+
32+
- name: Install Python dependencies
33+
if: hashFiles('requirements.txt') != ''
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install -r requirements.txt
37+
38+
- name: Install Jupyter basics (if not in requirements)
39+
if: hashFiles('requirements.txt') == ''
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install jupyter nbconvert ipykernel
43+
44+
- name: Set up Quarto
45+
uses: quarto-dev/quarto-actions/setup@v2
46+
with:
47+
tinytex: true
48+
49+
- name: Render Quarto book
50+
run: |
51+
quarto render
52+
53+
- name: Upload website artifact
54+
if: ${{ github.ref == 'refs/heads/main' }}
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: _book
58+
59+
deploy:
60+
if: ${{ github.ref == 'refs/heads/main' }}
61+
needs: build
62+
runs-on: ubuntu-latest
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
67+
steps:
68+
- name: Deploy to GitHub Pages
69+
id: deployment
70+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)