Skip to content

修复GitHub Actions构建问题:使用npm install --legacy-peer-deps替代npm ci #3

修复GitHub Actions构建问题:使用npm install --legacy-peer-deps替代npm ci

修复GitHub Actions构建问题:使用npm install --legacy-peer-deps替代npm ci #3

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- main # 当主分支有提交时触发
# 设置部署权限
permissions:
contents: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 代码
uses: actions/checkout@v3
- name: 设置 Node.js 环境
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: 安装依赖
run: npm install --legacy-peer-deps
- name: 构建项目
run: npm run build
- name: 部署到 GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: dist # Vite 默认的构建输出目录
branch: gh-pages # 部署到的分支
clean: true # 部署前清理分支