From b4f60d42628949d2e5f05df4283348e646d3cc05 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 26 Nov 2025 07:27:51 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20GitHub=20Actions=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=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/workflows/deploy.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6d2f602 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,41 @@ +name: 部署到 GitHub Pages + +on: + push: + branches: + - develop # 当推送到 develop 分支时触发 + workflow_dispatch: # 允许手动触发 + +permissions: + contents: write # 允许推送到 gh-pages 分支 + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: 检出代码 + uses: actions/checkout@v3 + + - name: 设置 Node.js + uses: actions/setup-node@v3 + with: + node-version: '16' + cache: 'npm' + + - name: 安装依赖 + run: npm ci + + - name: 构建项目 + run: NODE_OPTIONS=--openssl-legacy-provider npm run build + + - name: 添加 CNAME 文件 + run: echo "kalman.l2k.tech" > dist/CNAME + + - name: 部署到 GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist + publish_branch: gh-pages # 部署到 gh-pages 分支 + cname: kalman.l2k.tech