Skip to content

Commit 2552212

Browse files
authored
Refactor GitHub Pages workflow for Jupyter Book
Updated GitHub Actions workflow for Jupyter Book to specify paths and improve caching.
1 parent cd72cf2 commit 2552212

File tree

1 file changed

+18
-27
lines changed

1 file changed

+18
-27
lines changed

.github/workflows/github_pages.yml

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,44 @@ jobs:
1313
pages: write
1414
id-token: write
1515
steps:
16+
# 拉取仓库
1617
- uses: actions/checkout@v4
1718

19+
# 设置 Python 3.11
1820
- name: Set up Python 3.11
1921
uses: actions/setup-python@v5
2022
with:
2123
python-version: '3.11'
2224
cache: pip
2325

24-
- name: Install dependencies (requirements.txt)
26+
# 安装依赖
27+
- name: Install dependencies
2528
run: |
26-
python -m pip install --upgrade pip
27-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28-
# ensure jupyter-book is installed even if not in requirements.txt
29-
pip install -U jupyter-book
29+
cd "DSPC6000/Computing in Context/carlboy2002.github.io"
30+
pip install --upgrade pip
31+
pip install -r requirements.txt
3032
31-
- name: Show repo root (debug)
32-
run: |
33-
echo "PWD: $(pwd)"
34-
ls -la
35-
36-
- name: cache executed notebooks
33+
# 可选:缓存执行过的 notebooks
34+
- name: Cache executed notebooks
3735
uses: actions/cache@v4
3836
with:
39-
path: _build/.jupyter_cache
40-
key: jupyter-book-cache-${{ hashFiles('requirements.txt') }}
37+
path: DSPC6000/Computing in Context/carlboy2002.github.io/_build/.jupyter_cache
38+
key: jupyter-book-cache-${{ hashFiles('DSPC6000/Computing in Context/carlboy2002.github.io/requirements.txt') }}
4139

40+
# 构建 Jupyter Book
4241
- name: Build the book
4342
run: |
44-
set -euxo pipefail
45-
# build the book; adjust command if your sources sit in a subfolder
43+
cd "DSPC6000/Computing in Context/carlboy2002.github.io"
4644
jupyter-book build .
47-
48-
- name: Show _build contents (debug)
49-
run: |
50-
echo "----- ls -la _build -----"
51-
ls -la _build || true
52-
echo "----- recursive find for html dirs under _build -----"
53-
find _build -maxdepth 5 -type d -name 'html' -print || true
54-
echo "----- all files under _build -----"
55-
find _build -maxdepth 5 -print || true
5645
57-
- name: Upload artifact (pages)
46+
# 上传构建好的 HTML
47+
- name: Upload artifact
5848
uses: actions/upload-pages-artifact@v3
5949
with:
60-
# keep _build/html as default, but if your build wrote elsewhere (see above debug)
61-
path: _build/html
50+
path: "DSPC6000/Computing in Context/carlboy2002.github.io/_build/html"
6251

52+
# 部署到 GitHub Pages
6353
- name: Deploy to GitHub Pages
6454
id: deployment
6555
uses: actions/deploy-pages@v4
56+

0 commit comments

Comments
 (0)