Skip to content

Commit af2172f

Browse files
committed
change deployment script to suggestion from Jupyter Book documentation
https://jupyterbook.org/v1/publish/gh-pages.html
1 parent 69bd67b commit af2172f

File tree

2 files changed

+50
-32
lines changed

2 files changed

+50
-32
lines changed

.github/workflows/main.yml

Lines changed: 49 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,62 @@
1-
name: CI
1+
name: deploy-book
22

3-
on:
3+
# Run this when the master or main branch changes
4+
on:
45
push:
5-
branches:
6+
branches:
67
- master
8+
- main
9+
# If your git repository has the Jupyter Book within some-subfolder next to
10+
# unrelated files, you can make this run only if a file within that specific
11+
# folder has been modified.
12+
#
13+
# paths:
14+
# - some-subfolder/**
715

16+
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
817
jobs:
9-
build:
18+
deploy-book:
1019
runs-on: ubuntu-latest
20+
permissions:
21+
pages: write
22+
id-token: write
1123
steps:
12-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
1325

14-
- name: Setup Python
15-
uses: actions/setup-python@v5
26+
# Install dependencies
27+
- name: Set up Python
28+
uses: actions/setup-python@v6
1629
with:
17-
python-version: '3.10'
18-
19-
- name: install
30+
python-version: "3.13"
31+
cache: pip # Implicitly uses requirements.txt for cache key
32+
33+
- name: Install dependencies
34+
run: pip install -r requirements.txt
35+
36+
# (optional) Cache your executed notebooks between runs
37+
# if you have config:
38+
# execute:
39+
# execute_notebooks: cache
40+
- name: cache executed notebooks
41+
uses: actions/cache@v4
42+
with:
43+
path: _build/.jupyter_cache
44+
key: jupyter-book-cache-${{ hashFiles('requirements.txt') }}
45+
46+
# Build the book
47+
- name: Build the book
2048
run: |
21-
python --version
22-
python -m pip install setuptools
23-
python -m pip install -r requirements.txt
24-
25-
- name: build
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28-
run: |
29-
30-
cd $GITHUB_WORKSPACE
31-
git init
32-
git config user.name "Github Actions"
33-
git config user.email "[email protected]"
34-
REPOSITORY_PATH="https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
35-
36-
git checkout master
3749
jupyter-book build .
3850
39-
- name: Deploy
40-
uses: peaceiris/actions-gh-pages@v3
51+
# https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow
52+
53+
# Upload the book's HTML as an artifact
54+
- name: Upload artifact
55+
uses: actions/upload-pages-artifact@v4
4156
with:
42-
github_token: ${{ secrets.GITHUB_TOKEN }}
43-
force_orphan: true
44-
publish_dir: ./_build/html
57+
path: _build/html
58+
59+
# Deploy the book's HTML to GitHub Pages
60+
- name: Deploy to GitHub Pages
61+
id: deployment
62+
uses: actions/deploy-pages@v4

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
sphinx
22
matplotlib
3-
jupyter-book
3+
jupyter-book==1.0.4
44
scikit-learn

0 commit comments

Comments
 (0)