Skip to content

Commit ce7329e

Browse files
committed
add docs workflow
1 parent dd039fc commit ce7329e

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/docs.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Sync Docs to Documentation Site
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- "docs/**"
9+
10+
jobs:
11+
sync-docs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout master branch
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
ref: master
19+
20+
- name: Set up Git
21+
run: |
22+
git config --global user.name "github-actions[bot]"
23+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
24+
25+
- name: Fetch docs-website branch
26+
run: git fetch origin docs-website:docs-website
27+
28+
- name: Create temporary worktree
29+
run: git worktree add ../docs-website docs-website
30+
31+
- name: Sync docs to docs-website
32+
run: |
33+
rm -rf ../docs-website/src/content/docs/*
34+
cp -r docs/* ../docs-website/src/content/docs/
35+
36+
- name: Commit and push
37+
run: |
38+
cd ../docs-website
39+
git add src/content/docs/
40+
if git diff --cached --quiet; then
41+
echo "No changes to commit."
42+
else
43+
git commit -m "Sync docs from master branch"
44+
git push origin docs-website
45+
fi

0 commit comments

Comments
 (0)