-
Notifications
You must be signed in to change notification settings - Fork 4
54 lines (46 loc) · 1.41 KB
/
make_doc.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
54
name: Make doc
on:
push:
branches:
main
pull_request:
branches:
main
jobs:
build_doc:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build the doc
run: |
cd docs/ && pip install -r requirements.txt
make html && cd ..
- name: Refresh changes and commit
if: github.event_name == 'push'
run: |
git clone https://github.com/Meloland/melobot.git --branch gh-pages --single-branch gh-pages
mkdir tmp-files && cd gh-pages
mv CNAME .nojekyll README.md .git ../tmp-files
rm -rf * && rm .buildinfo && cd ..
cp -r docs/build/html/* gh-pages
cp docs/build/html/.buildinfo gh-pages
mv tmp-files/* tmp-files/.git tmp-files/.nojekyll gh-pages
rmdir tmp-files
cd gh-pages
git config --local user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git add .
git commit -m "Update doc by Github Action" -a || true
cd ..
- name: Push changes
if: github.event_name == 'push'
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}