-
Notifications
You must be signed in to change notification settings - Fork 12
130 lines (127 loc) · 4.33 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: docs
on:
pull_request:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/docs.yml
- '**.py'
- '**.ipynb'
- '**.html'
- '**.jinja'
- '**.js'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'
- docs/cyclops-webpage
types: [opened, synchronize, closed]
push:
branches:
- main
paths:
- .pre-commit-config.yaml
- .github/workflows/docs.yml
- '**.py'
- '**.ipynb'
- '**.html'
- '**.jinja'
- '**.js'
- poetry.lock
- pyproject.toml
- '**.rst'
- '**.md'
- docs/cyclops-webpage
jobs:
build:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize' || (github.event.action == 'closed' && github.event.pull_request.merged == true)))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: 'true'
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.1.0
with:
python-version: '3.10'
cache: 'poetry'
- name: Install dependencies, build docs without running notebooks
run: |
python3 -m pip install --upgrade pip && python3 -m pip install poetry
poetry env use '3.10'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test --all-extras
PANDOC_VERSION="2.19"
wget -q "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz"
tar xzf "pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz" --strip-components 1 -C /usr/local/
rm "pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz"
pandoc --version
cd docs
rm -rf source/reference/api/_autosummary
make html
- name: Set up Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 18
cache: yarn
cache-dependency-path: '**/yarn.lock'
- name: Build webpage
run: |
cd docs/cyclops-webpage
yarn install --frozen-lockfile
yarn build
cp -r ../build/html build/api
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: github_pages
publish_dir: docs/cyclops-webpage/build
release-build:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
with:
submodules: 'true'
- name: Install poetry
run: python3 -m pip install --upgrade pip && python3 -m pip install poetry
- uses: actions/setup-python@v5.1.0
with:
python-version: '3.10'
cache: 'poetry'
- name: Install dependencies, build docs with notebook execution
run: |
python3 -m pip install --upgrade pip && python3 -m pip install poetry
poetry env use '3.10'
source $(poetry env info --path)/bin/activate
poetry install --with docs,test --all-extras
PANDOC_VERSION="2.19"
wget -q "https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz"
tar xzf "pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz" --strip-components 1 -C /usr/local/
rm "pandoc-${PANDOC_VERSION}-linux-amd64.tar.gz"
pandoc --version
cd docs
rm -rf source/reference/api/_autosummary
make html-with-notebooks
- name: Set up Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 18
cache: yarn
cache-dependency-path: '**/yarn.lock'
- name: Build webpage
run: |
cd docs/cyclops-webpage
yarn install --frozen-lockfile
yarn build
cp -r ../build/html build/api
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: github_pages
publish_dir: docs/cyclops-webpage/build