Skip to content

Commit fc33b3e

Browse files
Soulteranka-afkzouyongheshuiping233LIghtJUNction
authored
docs: transfer AstrBotDevs/AstrBot-docs to AstrBotDevs/AstrBot (#5960)
* docs: transfer AstrBotDevs/AstrBot-docs to AstrBotDevs/AstrBot * refactor: reorder imports and improve type hints in sync_docs_to_wiki.py and upload_doc_images_to_r2.py * feat: add GitHub Actions workflow to sync wiki with documentation Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: anka-afk <110004162+anka-afk@users.noreply.github.com> Co-authored-by: zouyonghe <62183434+zouyonghe@users.noreply.github.com> Co-authored-by: shuiping233 <49360196+shuiping233@users.noreply.github.com> Co-authored-by: LIghtJUNction <106986785+LIghtJUNction@users.noreply.github.com> Co-authored-by: Sjshi763 <179909421+Sjshi763@users.noreply.github.com> Co-authored-by: xiewoc <70128845+xiewoc@users.noreply.github.com> Co-authored-by: QingFeng-awa <151742581+QingFeng-awa@users.noreply.github.com> Co-authored-by: PaloMiku <96452465+PaloMiku@users.noreply.github.com> Co-authored-by: shangxueink <138397030+shangxueink@users.noreply.github.com> Co-authored-by: IGCrystal-A <244300990+IGCrystal-A@users.noreply.github.com> Co-authored-by: RC-CHN <67079377+RC-CHN@users.noreply.github.com> Co-authored-by: MC090610 <113341105+MC090610@users.noreply.github.com> Co-authored-by: Waterwzy <196913419+Waterwzy@users.noreply.github.com> Co-authored-by: Lanhuace-Wan <186303160+Lanhuace-Wan@users.noreply.github.com> Co-authored-by: LiAlH4qwq <61769640+LiAlH4qwq@users.noreply.github.com> Co-authored-by: HSOS6 <209910899+HSOS6@users.noreply.github.com> Co-authored-by: th-dd <162813557+th-dd@users.noreply.github.com> Co-authored-by: miaoxutao123 <81676466+miaoxutao123@users.noreply.github.com> Co-authored-by: nuomicici <143102889+nuomicici@users.noreply.github.com> Co-authored-by: nasyt233 <210103278+nasyt233@users.noreply.github.com> Co-authored-by: jlugjb <7426462+jlugjb@users.noreply.github.com> Co-authored-by: Raven95676 <176760093+Raven95676@users.noreply.github.com> Co-authored-by: Futureppo <180109455+Futureppo@users.noreply.github.com> Co-authored-by: MliKiowa <61873808+MliKiowa@users.noreply.github.com> Co-authored-by: Fridemn <150212937+Fridemn@users.noreply.github.com> Co-authored-by: BakaCookie520 <138355736+BakaCookie520@users.noreply.github.com> Co-authored-by: YumeYuka <125112916+YumeYuka@users.noreply.github.com> Co-authored-by: xming521 <32786500+xming521@users.noreply.github.com> Co-authored-by: ywh555hhh <121592812+ywh555hhh@users.noreply.github.com> Co-authored-by: stevessr <89645372+stevessr@users.noreply.github.com> Co-authored-by: roeseth <41995115+roeseth@users.noreply.github.com> Co-authored-by: ikun-1145141 <265925499+ikun-1145141@users.noreply.github.com> Co-authored-by: evpeople <54983536+evpeople@users.noreply.github.com> Co-authored-by: Yue-bin <60509781+Yue-bin@users.noreply.github.com> Co-authored-by: W1ndys <109416673+W1ndys@users.noreply.github.com> Co-authored-by: TheFurina <218887821+TheFurina@users.noreply.github.com> Co-authored-by: Seayon <12275933+Seayon@users.noreply.github.com> Co-authored-by: OnlyblackTea <38585636+OnlyblackTea@users.noreply.github.com> Co-authored-by: ocetars <74854972+ocetars@users.noreply.github.com> Co-authored-by: railgun19457 <117180744+railgun19457@users.noreply.github.com> Co-authored-by: JunieXD <107397009+JunieXD@users.noreply.github.com> Co-authored-by: advent259141 <197440256+advent259141@users.noreply.github.com> Co-authored-by: Doge2077 <91442300+Doge2077@users.noreply.github.com> Co-authored-by: Bocity <23430545+Bocity@users.noreply.github.com> Co-authored-by: Aurora-xk <192227833+Aurora-xk@users.noreply.github.com>
1 parent 795aec9 commit fc33b3e

219 files changed

Lines changed: 20618 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-docs.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches: ["master"]
6+
paths:
7+
- "docs/**"
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest # 运行环境
12+
steps:
13+
- name: checkout
14+
uses: actions/checkout@master
15+
- name: nodejs installation
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: "18"
19+
- name: npm install
20+
run: npm add -D vitepress
21+
working-directory: './docs' # working-directory 指定 shell 命令运行目录
22+
- name: npm run build
23+
run: npm run docs:build
24+
working-directory: './docs'
25+
- name: scp
26+
uses: appleboy/scp-action@master
27+
with:
28+
host: ${{ secrets.HOST_NEKO }}
29+
username: ${{ secrets.USERNAME }}
30+
password: ${{ secrets.PASSWORDNEKO }}
31+
source: 'docs/.vitepress/dist/*'
32+
target: '/tmp/'
33+
- name: script
34+
uses: appleboy/ssh-action@master
35+
with:
36+
host: ${{ secrets.HOST_NEKO }}
37+
username: ${{ secrets.USERNAME }}
38+
password: ${{ secrets.PASSWORDNEKO }}
39+
script: |
40+
mkdir -p /root/docker_data/caddy/caddy_data/static_site/abv4/
41+
rm -rf /root/docker_data/caddy/caddy_data/static_site/abv4/*
42+
mv /tmp/docs/.vitepress/dist/* /root/docker_data/caddy/caddy_data/static_site/abv4/
43+
rm -rf /tmp/docs/

.github/workflows/sync-wiki.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: sync wiki
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
paths:
9+
- '.github/workflows/sync-wiki.yml'
10+
- 'docs/scripts/sync_docs_to_wiki.py'
11+
- 'docs/tests/test_sync_docs_to_wiki.py'
12+
- 'docs/zh/**'
13+
- 'docs/en/**'
14+
15+
concurrency:
16+
group: sync-wiki-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
sync:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
25+
steps:
26+
- name: Validate manual ref
27+
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/master'
28+
run: |
29+
echo "This workflow only publishes from refs/heads/master. Re-run it from the master branch."
30+
exit 1
31+
32+
- name: Check out docs repository
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Python
36+
uses: actions/setup-python@v5
37+
with:
38+
python-version: '3.11'
39+
40+
- name: Run sync unit tests
41+
working-directory: docs
42+
run: python -m unittest discover -s tests -p 'test_sync_docs_to_wiki.py' -v
43+
44+
- name: Validate internal doc links
45+
run: python docs/scripts/sync_docs_to_wiki.py --source-root docs --check-links-only
46+
47+
- name: Clone AstrBot wiki
48+
env:
49+
WIKI_TOKEN: ${{ secrets.ASTRBOT_WIKI_TOKEN }}
50+
run: |
51+
test -n "$WIKI_TOKEN"
52+
git clone "https://x-access-token:${WIKI_TOKEN}@github.com/AstrBotDevs/AstrBot.wiki.git" wiki
53+
54+
- name: Generate wiki pages
55+
run: python docs/scripts/sync_docs_to_wiki.py --source-root docs --wiki-root wiki
56+
57+
- name: Commit and push wiki changes
58+
working-directory: wiki
59+
run: |
60+
git config user.name "github-actions[bot]"
61+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
62+
git add .
63+
if git diff --cached --quiet; then
64+
echo "No wiki changes to push"
65+
exit 0
66+
fi
67+
git commit -m "docs: sync wiki from AstrBot-1/docs"
68+
git push

docs/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
__pycache__/
2+
venv/
3+
.DS_Store
4+
node_modules/
5+
.vitepress/cache
6+
*dist

0 commit comments

Comments
 (0)