Fix deploy.yml for static readme issue #10
This file contains 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
# GitHub Actions workflow to build and deploy a Jupyter Book to GitHub Pages | |
# This workflow runs when changes are pushed to the main branch | |
# It sets up Python, installs dependencies, builds the book, and deploys it | |
name: deploy-book | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**' # Trigger on any file changes | |
jobs: | |
deploy-book: | |
runs-on: ubuntu-latest | |
# Required permissions for GitHub Pages deployment | |
permissions: | |
contents: write # Needed to push to gh-pages branch | |
pages: write # Needed for Pages deployment | |
id-token: write # Needed for Pages deployment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} # URL where site will be published | |
steps: | |
# Check out the repository code | |
- uses: actions/checkout@v4 | |
# Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
# Install required Python packages | |
- name: Install dependencies | |
run: | | |
pip install -r requirements.txt | |
# Build the Jupyter Book | |
- name: Build the book | |
run: | | |
jupyter-book build . | |
# Deploy the built book to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_build/html # Directory containing the built site | |
force_orphan: true # Keep only latest commit in gh-pages branch |