Files
TinyTorch/.github/workflows/deploy-book.yml
Vijay Janapa Reddi 639cfbc339 feat: Update GitHub Actions workflow for raw export builds
- Add module conversion step before book building
- Install jupytext dependency for conversion script
- Maintains existing GitHub Pages deployment pipeline
- Automatically converts modules/source/ to notebooks on deploy
2025-07-15 12:51:32 -04:00

73 lines
1.7 KiB
YAML

name: Deploy TinyTorch Jupyter Book
# Trigger the workflow on push to main branch or manual dispatch
on:
push:
branches: [ main ]
paths:
- 'book/**'
- 'modules/source/**'
- '.github/workflows/deploy-book.yml'
pull_request:
branches: [ main ]
paths:
- 'book/**'
- 'modules/source/**'
workflow_dispatch:
# Set permissions for GitHub Pages deployment
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
pip install --upgrade pip
pip install jupyter-book jupytext
pip install -r book/tinytorch-course/requirements.txt
- name: Convert modules to notebooks
run: |
python book/convert_modules.py --all
- name: Build the book
run: |
cd book/tinytorch-course
jupyter-book build . --all
- name: Upload book artifact
uses: actions/upload-pages-artifact@v3
with:
path: book/tinytorch-course/_build/html
deploy:
# Only deploy on main branch pushes (not PRs)
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4