Skip to content

Commit e582478

Browse files
committed
Add github action to build and deploy docs
1 parent 13d90db commit e582478

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/deploy_site.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build and/or deploy documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "*"
10+
11+
jobs:
12+
build_docs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Generate HTML docs
17+
uses: ammaraskar/sphinx-action@master
18+
with:
19+
docs-folder: "doc/"
20+
pre-build-command: |
21+
apt-get update
22+
pip install -U pip
23+
pip install -e ".[doc]"
24+
- name: Upload generated HTML as artifact
25+
uses: actions/upload-artifact@v2
26+
with:
27+
name: DocHTML
28+
path: doc/_build/html/
29+
30+
deploy_docs:
31+
if: github.ref == 'refs/heads/main'
32+
needs: build_docs
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Download artifacts
37+
uses: actions/download-artifact@v2
38+
with:
39+
name: DocHTML
40+
path: doc/_build/html/
41+
- name: Commit to documentation branch
42+
run: |
43+
git clone --no-checkout --depth 1 https://github.com/alexisthual/brain-cockpit.git --branch gh-pages --single-branch gh-pages
44+
cp -r doc/_build/html/* gh-pages/
45+
cd gh-pages
46+
touch .nojekyll
47+
git config --local user.email "[email protected]"
48+
git config --local user.name "brain-cockpit GitHub Action"
49+
git add .
50+
git commit -m "Update documentation" -a || true
51+
- name: Push changes
52+
uses: ad-m/[email protected]
53+
with:
54+
branch: gh-pages
55+
directory: gh-pages
56+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)