Skip to content

Commit fe1d911

Browse files
committed
chore: add sync gitbook action
1 parent 699cab7 commit fe1d911

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/sync-gitbook.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Sync GitBook Content
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
sync-docs:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
12+
steps:
13+
- name: Checkout Main
14+
uses: actions/checkout@v4
15+
with:
16+
ref: main
17+
18+
- name: Checkout gh-pages
19+
uses: actions/checkout@v4
20+
with:
21+
ref: gh-pages
22+
path: temp_gh_pages
23+
24+
- name: Sync files to docs
25+
run: |
26+
mkdir -p docs
27+
# Sync content from gh-pages to docs folder
28+
# Using rsync to handle deletion of removed files and exclusion of .git
29+
rsync -av --delete --exclude '.git' --exclude '.github' temp_gh_pages/ docs/
30+
31+
# Clean up temporary directory
32+
rm -rf temp_gh_pages
33+
34+
- name: Commit and Push
35+
uses: stefanzweifel/git-auto-commit-action@v5
36+
with:
37+
commit_message: "docs: sync from gh-pages branch"
38+
branch: main
39+
file_pattern: 'docs/'
40+

0 commit comments

Comments
 (0)