-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (45 loc) · 1.49 KB
/
docs.yml
File metadata and controls
52 lines (45 loc) · 1.49 KB
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
name: Build & Deploy Docs
on:
push:
tags:
- "v*"
jobs:
build-deploy-docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install docs requirements
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
- name: Build HTML docs
run: |
cd docs
sphinx-build -b html . _build/html
# Deploy versioned docs
- name: Deploy versioned docs
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
destination_dir: ${{ github.ref_name }}
keep_files: true
# Deploy latest/ docs (copy of versioned folder)
- name: Deploy latest docs
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git clone --branch gh-pages https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} gh-pages
cd gh-pages
rm -rf latest
cp -r ${{ github.ref_name }} latest
git add latest
git commit -m "Update latest docs to ${{ github.ref_name }}" || echo "No changes to commit"
git push origin gh-pages