Create build_book.yaml #1
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: Build and Deploy Quarto Book | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 23 * * *" # run every day at 11 PM UTC | |
| env: | |
| RUST_BACKTRACE: 1 | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install Python dependencies | |
| if: hashFiles('requirements.txt') != '' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Install Jupyter basics (if not in requirements) | |
| if: hashFiles('requirements.txt') == '' | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install jupyter nbconvert ipykernel | |
| - name: Set up Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| with: | |
| tinytex: true | |
| - name: Render Quarto book | |
| run: | | |
| quarto render | |
| - name: Upload website artifact | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _book | |
| deploy: | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |