Skip to content

Commit 940ca73

Browse files
authored
[CI] Create update-docs.yml
1 parent 8fc5586 commit 940ca73

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/update-docs.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Update Docs
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- 'mpython/**'
8+
- '.github/workflows/update-docs.yml'
9+
10+
jobs:
11+
build-docs:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
persist-credentials: false
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install pdoc3
29+
30+
- name: Generate docs
31+
run: |
32+
rm -rf docs
33+
mkdir -p docs
34+
pdoc3 --html mpython --output-dir docs --force
35+
mv docs/mpython/* docs/
36+
rmdir docs/mpython
37+
38+
- name: Commit and push changes
39+
run: |
40+
git config --global user.name 'github-actions[bot]'
41+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
42+
git add docs
43+
git commit -m "[Doc] Regenerate" || echo "No changes to commit"
44+
git push
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)