Skip to content

Commit d80b31c

Browse files
committed
[melobot] Add docs build workflow
1 parent f591313 commit d80b31c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/mkdoc.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: makedoc
2+
3+
on:
4+
push:
5+
branches:
6+
main
7+
8+
pull_request:
9+
branches:
10+
main
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.10'
24+
25+
- name: Build the doc
26+
run: |
27+
cd docs/ && pip install -r requirements.txt
28+
make html && cd ..
29+
30+
- name: Refresh changes and commit
31+
run: |
32+
git clone https://github.com/Meloland/melobot.git --branch gh-pages --single-branch gh-pages
33+
mkdir tmp-files && cd gh-pages
34+
mv CNAME .nojekyll README.md .git ../tmp-files
35+
rm -rf * && rm .buildinfo && cd ..
36+
cp -r docs/build/html/* gh-pages
37+
cp docs/build/html/.buildinfo gh-pages
38+
mv tmp-files/* tmp-files/.git tmp-files/.nojekyll gh-pages
39+
rmdir tmp-files
40+
cd gh-pages
41+
git config --local user.email "action@github.com"
42+
git config --local user.name "GitHub Action"
43+
git add .
44+
git commit -m "Update doc by Github Action" -a || true
45+
cd ..
46+
47+
- name: Push changes
48+
uses: ad-m/github-push-action@master
49+
with:
50+
branch: gh-pages
51+
directory: gh-pages
52+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)