Skip to content

fix(Lec.5): 惩罚函数法部分格式问题 #8

fix(Lec.5): 惩罚函数法部分格式问题

fix(Lec.5): 惩罚函数法部分格式问题 #8

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches: ["main"]
workflow_dispatch:
# 权限设置:允许 Actions 写入 Pages 和读取内容
permissions:
contents: read
pages: write
id-token: write
# 允许并发部署,但不取消正在进行的部署(生产环境安全)
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# 1. 安装 Rust 工具链
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
# 2. 缓存 Cargo 依赖
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
# 3. 安装 mdbook 和插件
- name: Install mdbook & plugins
run: |
if ! command -v mdbook &> /dev/null; then
cargo install mdbook --version 0.5.2
fi
if ! command -v mdbook-katex &> /dev/null; then
cargo install mdbook-katex --version 0.10.0-alpha
fi
# 4. 配置 Pages (官方步骤)
- name: Setup Pages
uses: actions/configure-pages@v5
# 5. 构建书籍
- name: Build Book
run: mdbook build
# 6. 上传构建产物 (官方步骤,替代 git push)
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./book
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4