-
Notifications
You must be signed in to change notification settings - Fork 15
52 lines (44 loc) · 1.56 KB
/
fmudataio-documention.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
# build and test some end points
name: Build and deploy docs for fmu-dataio
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install fmu-dataio
run: |
pip install -U pip
pip install .[docs]
- name: Generate examples
run: sh examples/run_examples.sh
- name: Build documentation
run: sphinx-build -b html docs/src build/docs/html -j auto
- name: Update GitHub pages
if: github.repository_owner == 'equinor' && github.ref == 'refs/heads/main'
run: |
cp -R ./build/docs/html ../html
git config --local user.email "fmu-dataio-github-action"
git config --local user.name "fmu-dataio-github-action"
git fetch origin gh-pages
git checkout --track origin/gh-pages
git clean -f -f -d -x # Double -f is intentional.
git rm -r *
cp -R ../html/* .
touch .nojekyll # If not, github pages ignores _* directories.
git add .
echo "Ready for commit"
if git diff-index --quiet HEAD; then
echo "No changes in documentation. Skip documentation deploy."
else
git commit -m "Update Github Pages"
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages
fi