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: docs build | |
on: | |
push: | |
branches: | |
# 确保这是你正在使用的分支名称 | |
- main | |
jobs: | |
LearnHubs-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v4 | |
with: | |
# 获取所有标记和分支的所有历史记录(updatetime 必须,否则每次都会变化) | |
fetch-depth: 0 | |
# 如果你文档需要 Git 子模块,取消注释下一行 | |
# submodules: true | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
run_install: true | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: pnpm | |
# 将读书笔记复制到静态页路径,然后构建页面 | |
- name: Build Docs | |
env: | |
NODE_OPTIONS: --max_old_space_size=8192 | |
run: |- | |
pnpm cpx "docs/reading/**" docs/.vuepress/public/reading | |
pnpm run docs:build | |
> docs/.vuepress/dist/.nojekyll | |
#部署到 https://libaxuan.github.io 关闭 | |
- name: Deploy GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
# 这是文档部署到的分支名称 | |
branch: lh-pages | |
folder: docs/.vuepress/dist | |
# 将页面更新到 Vercel | |
- name: Copy file to Vercel | |
if: always() | |
uses: andstor/copycat-action@v3 | |
with: | |
personal_token: ${{ secrets.PERSONAL_TOKEN }} | |
src_path: /. | |
dst_path: / | |
# 你的用户名 | |
dst_owner: libaxuan | |
# 与 Vercel 链接的仓库名,也就是 Vercel 部署时新建的仓库 | |
dst_repo_name: LearnHubs-vercel | |
dst_branch: main | |
src_branch: lh-pages | |
clean: true |