|
6 | 6 | - master |
7 | 7 | - main |
8 | 8 |
|
| 9 | +permissions: |
| 10 | + pages: write |
| 11 | + id-token: write |
| 12 | + |
9 | 13 | jobs: |
10 | 14 | deploy-book: |
11 | 15 | runs-on: ubuntu-latest |
12 | | - permissions: |
13 | | - pages: write |
14 | | - id-token: write |
| 16 | + |
15 | 17 | steps: |
16 | | - # 拉取仓库 |
17 | | - - uses: actions/checkout@v4 |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v4 |
18 | 20 |
|
19 | | - # 设置 Python 3.11 |
20 | 21 | - name: Set up Python 3.11 |
21 | 22 | uses: actions/setup-python@v5 |
22 | 23 | with: |
23 | 24 | python-version: '3.11' |
24 | | - cache: pip |
25 | | - |
26 | | - # 安装依赖 |
27 | | - - name: Install dependencies |
28 | | - run: | |
29 | | - cd "DSPC6000/Computing in Context/carlboy2002.github.io" |
30 | | - pip install --upgrade pip |
31 | | - pip install -r requirements.txt |
| 25 | + cache: 'pip' |
32 | 26 |
|
33 | | - # 可选:缓存执行过的 notebooks |
34 | | - - name: Cache executed notebooks |
| 27 | + - name: Cache pip dependencies |
35 | 28 | uses: actions/cache@v4 |
36 | 29 | with: |
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') }} |
| 30 | + path: ~/.cache/pip |
| 31 | + key: pip-cache-${{ runner.os }}-requirements-${{ hashFiles('requirements.txt') }} |
| 32 | + restore-keys: | |
| 33 | + pip-cache-${{ runner.os }}- |
39 | 34 |
|
40 | | - # 构建 Jupyter Book |
41 | | - - name: Build the book |
| 35 | + - name: Install dependencies |
42 | 36 | run: | |
43 | | - cd "DSPC6000/Computing in Context/carlboy2002.github.io" |
44 | | - jupyter-book build . |
| 37 | + python -m pip install --upgrade pip |
| 38 | + pip install -r requirements.txt |
45 | 39 |
|
46 | | - # 上传构建好的 HTML |
47 | | - - name: Upload artifact |
| 40 | + - name: Build Jupyter Book |
| 41 | + run: jupyter-book build . |
| 42 | + |
| 43 | + - name: Upload built site |
48 | 44 | uses: actions/upload-pages-artifact@v3 |
49 | 45 | with: |
50 | | - path: "DSPC6000/Computing in Context/carlboy2002.github.io/_build/html" |
| 46 | + path: _build/html |
51 | 47 |
|
52 | | - # 部署到 GitHub Pages |
53 | 48 | - name: Deploy to GitHub Pages |
54 | 49 | id: deployment |
55 | 50 | uses: actions/deploy-pages@v4 |
56 | | - |
0 commit comments