Update GitHub Actions workflow for book build #3
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 * * *" # daily at 23:00 UTC | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| # Use the Python version your project expects | |
| python-version: "3.12" | |
| - name: Sync project environment | |
| run: | | |
| uv sync | |
| - name: Install Quarto | |
| uses: quarto-dev/quarto-actions/setup@v2 | |
| with: | |
| tinytex: false | |
| - name: Render book with uv | |
| run: | | |
| uv run quarto render --execute | |
| - name: Copy data folder into book output | |
| run: | | |
| mkdir -p _book/data | |
| cp -r data/* _book/data/ | |
| - name: Upload site 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 |