-
Notifications
You must be signed in to change notification settings - Fork 11
58 lines (55 loc) · 1.69 KB
/
deploy-docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Deploy Doc Site
on:
workflow_dispatch
concurrency:
group: "gh-pages-branch-workflow" # 唯一标识符,确保只运行一个实例
cancel-in-progress: false # 不取消正在运行的实例,后续触发需要等待当前实例完成
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Check if branch is main
run: |
if [ "$GITHUB_REF" != "refs/heads/gh-pages" ]; then
echo "Not on gh-pages branch, exiting workflow."
exit 0
fi
echo "On gh-pages branch, continuing workflow."
- name: Config Git User
run: |
git config --local user.name "dragooncjw"
git config --local user.email "[email protected]"
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org/'
- 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 docs
run: |
cd apps/docs
npm run docs
- name: Copy auto-docs to en
run: cp -r apps/docs/src/zh/auto-docs apps/docs/src/en/auto-docs
- name: Build Doc site
run: |
cd apps/docs
npm run build
- name: Replace docs
run: |
rm -rf docs
mv apps/docs/doc_build docs
- name: Push code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add .
git commit -m "chore: update docs" -n
git push