Skip to content

Change the build to release mode and add one more debugging log #7

Change the build to release mode and add one more debugging log

Change the build to release mode and add one more debugging log #7

Workflow file for this run

# .github/workflows/deploy.yml
name: Build and Deploy Yew App to GitHub Pages
on:
push:
branches:
- main # 当 main 分支有推送时触发
permissions:
contents: write # 赋予对仓库内容的写权限
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 1. 检出仓库代码
- name: Checkout repository
uses: actions/checkout@v3
# 2. 设置 Rust 工具链
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
override: true
# 3. 安装 wasm-pack
- name: Install wasm-pack
run: cargo install wasm-pack
# 4. 安装 cargo-make
- name: Install cargo-make
run: cargo install cargo-make
# 5. 构建项目
- name: Build project
run: cargo make build-ci || echo "Build failed" && exit 1
# 6. 列出 static 目录内容(用于调试)
- name: List static directory
run: ls -la ./static
- name: Ensure static directory has content
run: |
if [ -z "$(ls -A ./static)" ]; then
echo "Static directory is empty! Build might have failed."
exit 1
fi
# 7. 部署到 GitHub Pages
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./static
publish_branch: gh-pages
force_orphan: true
allow_empty_commit: true