-
Notifications
You must be signed in to change notification settings - Fork 6
70 lines (64 loc) · 1.91 KB
/
build_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
name: Documentation
on:
pull_request:
push:
branches: main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
# Force to use color
FORCE_COLOR: true
BROWSER: /usr/bin/firefox
DISPLAY: :99.0
permissions:
contents: write
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install -e .
python -m pip install .[doc,plotting]
- name: Sphinx build
id: build-docs
run: |
sphinx-build -b html doc_conf doc/_build/html
- name: Upload documentation
if: steps.build-docs.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: DocHTML
path: doc/_build/html
deploy_on_main:
runs-on: ubuntu-latest
needs: [build_docs]
if: ${{ contains(fromJSON('["push", "workflow_dispatch", "schedule"]'), github.event_name)}}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: DocHTML
path: doc/_build/html
- name: Commit to main
run: |
git clone --depth 1 https://github.com/${{ github.repository_owner }}/hidimstat.git
rm -Rf hidimstat/docs
mkdir hidimstat/docs
cp -r doc/_build/html/* hidimstat/docs
cd hidimstat
touch docs/.nojekyll
git config --global user.email "actions@github.com"
git config --global user.name "GitHub actions"
git add .
git commit -m "Update documentation" -a || true
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
directory: hidimstat
github_token: ${{ secrets.GITHUB_TOKEN }}