add favicon #10
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 VitePress site to Pages | |
on: | |
push: | |
branches: [main] # 或者如果你使用 master,替换为 master | |
workflow_dispatch: # 允许手动触发 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: pages | |
cancel-in-progress: false | |
jobs: | |
# 构建任务 | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # 拉取完整的历史记录,适用于 lastUpdated | |
# 设置 Node.js 环境 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm # 缓存 npm 依赖 | |
# 安装依赖 | |
- name: Install dependencies | |
run: npm ci # 或者 pnpm install, yarn install,根据你的依赖管理工具选择 | |
# 构建 VitePress 站点 | |
- name: Build VitePress site | |
run: npm run docs:build # 根据 package.json 中的配置,构建 VitePress | |
# 上传构建产物作为 GitHub Pages 工件 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: docs/.vitepress/dist # VitePress 默认的构建输出路径 | |
# 部署任务 | |
deploy: | |
needs: build # 等待 build 完成 | |
runs-on: ubuntu-latest | |
name: Deploy to GitHub Pages | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |