From 751cb1e341b67d2e3d19c087f4aff3bb076ff3f4 Mon Sep 17 00:00:00 2001 From: coolxitech Date: Mon, 15 Dec 2025 21:32:46 +0800 Subject: [PATCH] =?UTF-8?q?ci(github-actions):=20=E6=B7=BB=E5=8A=A0=20GitH?= =?UTF-8?q?ub=20Pages=20=E9=83=A8=E7=BD=B2=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增部署到 GitHub Pages 的自动化流程 - 配置在 main 分支推送时触发构建和部署 - 使用 pnpm 进行依赖安装与项目构建 - 通过 github-pages-deploy-action 推送构建产物至 gh-pages 分支 - 指定 docs 目录作为部署源文件夹 --- .github/workflows/github-pages.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/github-pages.yml diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml new file mode 100644 index 0000000..79f8c6f --- /dev/null +++ b/.github/workflows/github-pages.yml @@ -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 \ No newline at end of file