-
Notifications
You must be signed in to change notification settings - Fork 12
115 lines (95 loc) · 2.81 KB
/
docs.yaml
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
name: Build BridgeStan docs
on:
push:
branches:
- 'main'
workflow_dispatch:
inputs:
version:
description: 'Version of BridgeStan docs to build'
required: false
type: string
default: ''
workflow_call:
inputs:
version:
description: 'Version of BridgeStan docs to build'
required: true
type: string
release:
types: [published]
jobs:
build-docs:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out github
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies (python)
run: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade -r docs/requirements.txt
- name: Install os dependencies
run: |
sudo apt-get update -y
sudo apt-get install pandoc doxygen -y
- name: Set up Julia
uses: julia-actions/setup-julia@v2
- name: Install R
uses: r-lib/actions/setup-r@v2.10.1
- name: Install R dependencies
uses: r-lib/actions/setup-r-dependencies@v2.10.1
with:
packages: |
any::roxygen2
github::Genentech/rd2markdown
- name: Install packages
run: |
cd python/
pip install .
cd ../julia
julia --project=./docs -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
cd ../R/
Rscript -e "install.packages(getwd(), repos=NULL, type=\"source\")"
- name: Calculate version
if:
run: |
if [[ "${{ inputs.version }}" != "" ]]; then
echo "BS_DOCS_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
else
echo "BS_DOCS_VERSION=latest" >> $GITHUB_ENV
fi
- name: Build docs
run: |
cd docs/
export BS_DOCS_VERSION=$BS_DOCS_VERSION
make html
- name: Check out github
uses: actions/checkout@v4
with:
path: docs/_build/bs-docs
ref: gh-pages
- name: Commit html docs
run: |
cd docs/_build/
ls
rm -rf bs-docs/$BS_DOCS_VERSION
cp -r html bs-docs/$BS_DOCS_VERSION
cd bs-docs/
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit --amend -m "Rebuild docs"
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: docs/_build/bs-docs
force: true