feat: update yml #11
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: 部署文档到 GitHub Pages | |
on: | |
push: | |
branches: | |
- master # 监视主分支的推送 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 检出代码 | |
uses: actions/checkout@v2 | |
- name: 设置 Node.js 缓存目录 | |
id: cache-setup | |
run: | | |
echo "NODE_CACHE_DIR=$(npm config get cache)" >> $GITHUB_ENV | |
echo "PNPM_STORE_DIR=$(pnpm store path)" >> $GITHUB_ENV | |
- name: 缓存 pnpm 缓存 | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.PNPM_STORE_DIR }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 缓存 Node.js 模块 | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.NODE_CACHE_DIR }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: 安装 pnpm | |
run: npm install -g pnpm | |
- name: 安装依赖 | |
run: pnpm install | |
- name: 构建文档 | |
run: pnpm run docs:build # 使用你的构建命令 | |
- name: 部署到 GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.MY_PERSONAL_TOKEN }} # 使用你的个人访问令牌 | |
publish_dir: ./.vitepress/dist # 指向你的构建输出目录 | |
publish_branch: main # 目标仓库的分支 | |
external_repository: Zyunchao/zyunchao.github.io # 目标仓库的地址(不需要完整的 URL) |