Deploy Document #6
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 Document | ||
on: | ||
workflow_dispatch | ||
concurrency: | ||
group: "gh-branch-workflow" # 唯一标识符,确保只运行一个实例 | ||
cancel-in-progress: false # 不取消正在运行的实例,后续触发需要等待当前实例完成 | ||
jobs: | ||
push-code: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
content: write # 给予写权限,允许推送代码 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
token: ${{ secrets.REPO_PUSH_TOKEN }} | ||
- name: Get branch info | ||
run: git branch --show-current | ||
- name: Set up Git | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Rush Install | ||
run: node common/scripts/install-run-rush.js install | ||
- name: Rush build | ||
run: node common/scripts/install-run-rush.js build | ||
- name: Generate auto-docs | ||
run: | | ||
cd apps/docs | ||
npm run docs | ||
- name: build docs | ||
run: | | ||
cd apps/docs | ||
npm run build | ||
- name: Check Path | ||
run: pwd | ||
- name: Replace docs | ||
run: | | ||
rm -rf docs | ||
mv apps/docs/doc_build docs | ||
ls -al | ||
- name: Commit and Push | ||
run: | | ||
git add . | ||
git commit -m 'chore: update docs' -n | ||
git push | ||
env: | ||
REPO_PUSH_TOKEN: ${{ secrets.REPO_PUSH_TOKEN }} | ||