Skip to content

Commit 0efdbba

Browse files
committed
Refactor GitHub Actions workflow for Jupyter Book deployment: update branch names, streamline steps, and enhance Python setup.
1 parent 32cb234 commit 0efdbba

1 file changed

Lines changed: 42 additions & 18 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# This file was created automatically with `jupyter-book init --gh-pages` 🪄 💚
22
# Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**.
33

4-
name: Jupyter Book (via myst) GitHub Pages Deploy
4+
name: Jupyter Book HTML Deploy
55
on:
66
push:
7-
# Runs on pushes targeting the default branch
8-
branches: [main]
7+
# Trigger on pushes to the actual default branch (master in this repo)
8+
branches: [ master ]
9+
workflow_dispatch:
10+
inputs:
11+
clean:
12+
description: "Clean _build before building"
13+
required: false
14+
type: boolean
15+
default: false
916
env:
10-
# `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from.
11-
# E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`.
12-
# If, instead, your site lives at the root of the domain, at `https://mydomain.org`, set `BASE_URL=''`.
13-
BASE_URL: /${{ github.event.repository.name }}
17+
# Custom domain already configured (neuraldatascience.io), serve from root
18+
BASE_URL: ''
1419

1520
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1621
permissions:
@@ -23,26 +28,45 @@ concurrency:
2328
group: 'pages'
2429
cancel-in-progress: false
2530
jobs:
26-
deploy:
31+
build-deploy:
2732
environment:
2833
name: github-pages
2934
url: ${{ steps.deployment.outputs.page_url }}
3035
runs-on: ubuntu-latest
3136
steps:
32-
- uses: actions/checkout@v4
33-
- name: Setup Pages
34-
uses: actions/configure-pages@v3
35-
- uses: actions/setup-node@v4
37+
- name: Checkout
38+
uses: actions/checkout@v4
3639
with:
37-
node-version: 18.x
38-
- name: Install Jupyter Book (via myst)
39-
run: npm install -g jupyter-book
40-
- name: Build HTML Assets
41-
run: jupyter-book build --html
40+
fetch-depth: 0
41+
- name: Set up Python
42+
uses: actions/setup-python@v5
43+
with:
44+
python-version: '3.11'
45+
- name: Cache pip
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.cache/pip
49+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
50+
restore-keys: |
51+
${{ runner.os }}-pip-
52+
- name: Install dependencies
53+
run: |
54+
pip install --upgrade pip
55+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
56+
# Install jupyter-book (latest 2.x) explicitly; pin if stability needed
57+
pip install jupyter-book
58+
- name: (Optional) Clean previous builds
59+
if: inputs.clean == 'true'
60+
run: jupyter-book clean .
61+
- name: Build book (HTML)
62+
run: jupyter-book build .
63+
- name: List build output (debug)
64+
run: |
65+
ls -R _build/html | head -50 || echo "No html output found"
4266
- name: Upload artifact
4367
uses: actions/upload-pages-artifact@v3
4468
with:
45-
path: './_build/html'
69+
path: _build/html
4670
- name: Deploy to GitHub Pages
4771
id: deployment
4872
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)