-
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (46 loc) · 1.51 KB
/
sync-docs.yml
File metadata and controls
52 lines (46 loc) · 1.51 KB
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
name: Sync Documentation to gp-docs
on:
push:
branches:
- main
paths:
- '**/docs/**'
jobs:
sync-to-portal:
name: Sync docs to Central Portal
runs-on: ubuntu-latest
steps:
- name: Checkout gp-engine repository
uses: actions/checkout@v5
with:
path: gp-engine
- name: Checkout gp-docs
uses: actions/checkout@v5
with:
repository: GraphicalPlayground/gp-docs
token: ${{ secrets.DOCS_SYNC_PAT }}
path: gp-docs
- name: Sync Documentation
run: |
mkdir -p gp-docs/docs/gp-engine
cd gp-engine
find . -type f -path "*/docs/*" -print0 | while IFS= read -r -d '' file; do
rel_path="${file#./}"
dest_path=$(echo "$rel_path" | sed -e 's|^docs/||' -e 's|/docs/|/|g')
target_file="../gp-docs/docs/gp-engine/$dest_path"
mkdir -p "$(dirname "$target_file")"
cp "$file" "$target_file"
done
- name: Commit and Push Changes to gp-docs
run: |
cd gp-docs
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .
if ! git diff-index --quiet HEAD; then
git commit -m "sync(gp-engine): synchronize documentation from gp-engine"
git push -u origin main
echo "Successfully pushed new docs to gp-docs!"
else
echo "No changes to commit"
fi