ci(github-actions): 添加 GitHub Pages 部署工作流

- 新增部署到 GitHub Pages 的自动化流程
- 配置在 main 分支推送时触发构建和部署
- 使用 pnpm 进行依赖安装与项目构建
- 通过 github-pages-deploy-action 推送构建产物至 gh-pages 分支
- 指定 docs 目录作为部署源文件夹
This commit is contained in:
coolxitech
2025-12-15 21:32:46 +08:00
parent add90c5603
commit 751cb1e341

23
.github/workflows/github-pages.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: 部署到GitHub Pages
on:
push:
branches: [ main ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 代码检出
uses: actions/checkout@v6
- name: 构建前端页面
run: |
npm install -g pnpm && pnpm install
pnpm run build
- name: 推送到 Github
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs
branch: gh-pages