Update ci.yml #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- main # 监听 main 分支的推送 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code from the repository | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
# Step 2: Set up Node.js environment | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '23' # 你可以根据需求设置 Node.js 版本 | |
# Step 3: Install dependencies | |
- name: Install dependencies | |
run: npm install | |
# Step 4: Build the project | |
- name: Build the project | |
run: npm run build | |
# Step 5: Deploy to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages # 部署到 gh-pages 分支 | |
folder: dist # 要部署的文件夹,这里是 Vue 项目的 dist 目录 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub 提供的自动身份验证令牌 |