-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (70 loc) · 2.14 KB
/
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build and Deploy Docs
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "docs-deployment"
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies for docs
run: |
export SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True
python -m pip install --upgrade pip
sudo apt-get install -y pandoc # Add this line to install Pandoc
pip install -r docs/requirements.txt
- name: Build Sphinx docs
run: |
cd docs
make clean
make html
sphinx-build -b html --keep-going source _build/html
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html
- name: Pull latest gh-pages
run: |
git clone https://github.com/${{ github.repository }}.git --branch gh-pages --single-branch gh-pages
ls
- name: Copy new docs into gh-pages
if: (contains(github.ref, 'development') || contains(github.ref, 'main'))
run: |
rm -rf gh-pages/*
cp -r docs/_build/html/* gh-pages/
- name: Configure Git user
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@github.com"
- name: Check for changes
run: |
cd gh-pages
git add .
git diff-index --quiet HEAD || git commit -m "Update documentation"
- name: Push to gh-pages
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
run: |
cd gh-pages
git add .
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} gh-pages
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages