-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (47 loc) · 1.39 KB
/
update-wiki.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
name: Update Wiki
on:
push:
paths:
- docs/**
branches:
- main
env:
USER_TOKEN: ${{ secrets.WIKI_ACTION_TOKEN }} # This is the repository secret
USER_NAME: wiki-bot
USER_EMAIL: [email protected]
OWNER: SwanHubX
REPOSITORY_NAME: SwanLab-Toolkit
jobs:
publish_docs_to_wiki:
name: Publish docs to Wiki
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Python
uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Run parser
run: |
python3 scripts/parse_docs.py docs/wiki/
# 1. Create folder named `tmp_wiki`
# 2. Initialize Git
# 3. Pull old Wiki content
- name: Pull content from wiki
run: |
mkdir tmp_wiki
cd tmp_wiki
git init
git config user.name $USER_NAME
git config user.email $USER_EMAIL
git pull https://[email protected]/$OWNER/$REPOSITORY_NAME.wiki.git
# 4. Synchronize differences between `docs` & `tmp_wiki`
# 5. Push new Wiki content
- name: Push content to wiki
run: |
rsync -av --delete docs/ tmp_wiki/ --exclude .git
cd tmp_wiki
git add .
git commit -m "Update Wiki content"
git push -f --set-upstream https://[email protected]/$OWNER/$REPOSITORY_NAME.wiki.git master