-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (82 loc) · 2.65 KB
/
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Documentation
on:
push:
branches: [main]
tags: ["*"]
pull_request:
# Check all PR
schedule:
- cron: '0 8 * * 1' # run every Monday at 8am UTC
jobs:
setup:
runs-on: ubuntu-latest
outputs:
examplesmatrix: ${{ steps.collectExamples.outputs.examplesjson }}
steps:
- uses: actions/checkout@v4
- id: collectExamples
run: |
echo examplesjson=$(./src/get_examples.py) >> $GITHUB_OUTPUT
generate-example:
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
${{ fromJson(needs.setup.outputs.examplesmatrix) }}
steps:
- uses: actions/checkout@v4
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install dependencies
run: python -m pip install nox docutils
- name: build example
run: nox -e ${{ matrix.example-name }}
- name: store example as a github artifact
uses: actions/upload-artifact@v4
with:
name: example-${{ matrix.example-name }}
path: docs/src/examples/* # folders for each example will be merged later
overwrite: true # only keep the latest version of the example
build-and-publish:
needs: generate-example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: install dependencies
run: python -m pip install nox docutils
- name: load github artifact for each example
uses: actions/download-artifact@v4
with:
path: docs/src/examples
pattern: example-*
merge-multiple: true
- name: build documentation
run: nox -e build_docs
- name: store documentation as github artifact to be downloaded by users
uses: actions/upload-artifact@v4
with:
name: documentation
path: docs/build/html/*
overwrite: true # only keep the latest version of the documentation
- name: put documentation in the website
run: |
git clone https://github.com/$GITHUB_REPOSITORY --branch gh-pages gh-pages
rm -rf gh-pages/.git
cd gh-pages
# deploys directly to the root of the website
rm -rf *
mv ../docs/build/html/* .
- name: deploy to gh-pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages/
force_orphan: true
cname: atomistic-cookbook.org