👷 切换 github pages 使用 2.x 文档 #16
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 | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "master" branch | |
push: | |
branches: [ "2.x" ] | |
# 手动触发事件 | |
workflow_dispatch: | |
# jobs 是要执行的任务,我们看到他要执行 deploy | |
jobs: | |
build: | |
runs-on: ubuntu-latest # 运行环境 | |
steps: # 执行步骤 | |
# checkout 分支 | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'pnpm' | |
- name: Install pnpm dependencies | |
run: pnpm install | |
- name: Doc build | |
run: pnpm run docs:build | |
- run: cp -rf docs/.vitepress/dist/* . | |
- uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
clean: false | |
- run: git config user.name "${{ github.actor }}" | |
- run: git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- run: git add --all | |
- run: git commit --amend --no-edit | |
- run: git push -f |