-
Notifications
You must be signed in to change notification settings - Fork 54
67 lines (57 loc) · 1.99 KB
/
documentation.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
name: Build and publish documentation
on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install_python
run: |
sudo apt-get update -qy
sudo apt-get install -y python3-dev python3-pip libxml2-dev libxslt-dev zlib1g-dev libegl1 libopengl-dev
# Upgrade to latest meson and ninja
sudo pip install --upgrade meson ninja
# needs fenics to build fenics integration documentation snippet
- name: install_fenics
run: |
sudo apt-get install -y --no-install-recommends software-properties-common
sudo add-apt-repository -y ppa:fenics-packages/fenics
sudo apt-get update -qy
sudo apt-get install -y fenics python3-dolfin python3-mshr
- name: install_package
run: |
sudo pip install .[docs]
# Standard drop-in approach that should work for most people.
- name: build_doc
run: |
cd docs
make html SPHINXOPTS="-j auto"
cd ..
# Publish built docs to gh-pages branch.
# ===============================
- name: Commit documentation changes
run: |
git clone https://github.com/libAtoms/matscipy.git --branch gh-pages --single-branch gh-pages
cp -r docs/_build/html/* gh-pages/
cd gh-pages
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
# that.
- name: Push changes
if: github.ref == 'refs/heads/master'
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}