ci: 更新部署文档流程 #57
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: 部署文档和 Demo | |
on: | |
push: | |
branches: [master] | |
paths: | |
- 'docs/**' | |
- '.github/workflows/gh-pages.yml' | |
jobs: | |
create-gh-pages: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- name: 1. 检查分支 | |
uses: actions/checkout@v2 | |
- name: 2. 设置 Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 18 | |
- name: 3. 安装依赖 | |
run: yarn && cd docs && yarn | |
- name: 4. 构建文档和 Demo 页面 | |
run: yarn vite build --config ./sundry/demo.config.ts && cd docs && yarn docs:build && mv ./docs/.vitepress/dist/ ../gh-pages/docs/ | |
- name: 5. 保存并发布文档 | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.ref == 'refs/heads/master' }} | |
with: | |
publish_dir: ./gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} | |
commit_message: Update docs |