-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (54 loc) · 1.77 KB
/
generate-docs.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
55
56
57
58
59
60
61
name: generate docs
permissions:
contents: write
on:
push:
branches: main
paths:
- docs/conf.py
- '**.rst'
- '**.py'
- .github/workflows/generate-docs.yml
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
# Installation instructions are from: https://python-poetry.org/docs/
- name: Install dependencies
shell: bash
run: |
sudo apt update && sudo apt install -y \
enchant-2 \
--no-install-recommends
pip install \
poetry
- name: Build
shell: bash
run: |
poetry build
- name: Generate the docs
shell: bash
run: |
rm -rf docs/html
rm -rf docs/_autosummary
poetry install
poetry run sphinx-build -b html docs/ docs/html/
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --ignore-submodules --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Commit changes, if any
if: steps.git-check.outputs.modified == 'true'
run: |
git add .
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote set-url origin https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git commit -am "I HAVE GENERATED YOUR NEW DOCS!" || true
git fetch origin
git rebase origin/${{github.ref_name }} || true
git push origin ${{github.ref_name }}