-
Notifications
You must be signed in to change notification settings - Fork 1
102 lines (83 loc) · 2.81 KB
/
deploy-jupyterbook.yml
File metadata and controls
102 lines (83 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Deploy JupyterBook to GitHub Pages
# This workflow builds the JupyterBook site and deploys it to GitHub Pages
# Created with MyST/JupyterBook v2
name: Deploy JupyterBook to GitHub Pages
on:
push:
branches: [master, jupyterbook, main]
pull_request:
branches: [master, main]
workflow_dispatch: # Allow manual trigger
env:
# BASE_URL determines the URL path for GitHub Pages
# e.g., https://username.github.io/Montandon-Data-Fetching-Examples
BASE_URL: /${{ github.event.repository.name }}
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
defaults:
run:
working-directory: ./book
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
run: |
pip install uv
working-directory: .
- name: Install Python dependencies
run: |
uv sync
working-directory: .
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Install MyST Markdown
run: npm install -g mystmd
- name: Build HTML site
run: |
echo "Building JupyterBook with BASE_URL=${BASE_URL}"
uv run myst build --html
- name: Inject direct Binder buttons on notebook pages
run: |
uv run python scripts/inject_binder_buttons.py \
--build-dir book/_build/html \
--binder-url https://mybinder.org \
--binder-repo IFRCGo/montandon-notebooks \
--binder-ref main
working-directory: .
- name: List build output
run: |
echo "Contents of _build/html:"
ls -la _build/html/ | head -20
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./book/_build/html
deploy:
# Deploy on push to master/jupyterbook/main branch, or manual trigger
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/jupyterbook' || github.ref == 'refs/heads/main'))
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4