Skip to content

Enable PR previews

Enable PR previews #6

Workflow file for this run

name: deploy-book-preview
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
concurrency: preview-${{ github.ref }}
permissions:
contents: write
pull-requests: write
jobs:
deploy:
runs-on: ubuntu-latest
concurrency: pages-main
steps:
- name: Checkout book
uses: actions/checkout@v4
- name: Setup Python 3.12
if: github.event.action != 'closed'
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
if: github.event.action != 'closed'
run: |
pip install -r requirements.txt
- name: Get GitHub Pages URL
id: pages
if: github.event.action != 'closed'
uses: actions/configure-pages@v4
- name: Replace base URL
if: github.event.action != 'closed'
run: |
sed -i 's~baseurl: ""~baseurl: "${{ steps.pages.outputs.base_url }}/preview/pr-${{ github.event.number }}"~g' _config.yml
- name: Build book
if: github.event.action != 'closed'
run: |
jupyter-book build .
- name: Disable Jekyll to serve static HTML
run: |
touch _build/html/.nojekyll
- name: Commit preview to Pages branch
uses: rossjrw/pr-preview-action@v1.4.7
with:
source-dir: "_build/html"
umbrella-dir: preview