Skip to content

Makefile tweaks

Makefile tweaks #15

Workflow file for this run

name: Build TinyStan docs
on:
push:
branches:
- 'main'
workflow_dispatch:
inputs:
version:
description: 'Version of TinyStan docs to build'
required: false
type: string
default: ''
workflow_call:
inputs:
version:
description: 'Version of TinyStan docs to build'
required: true
type: string
release:
types: [published]
permissions:
contents: write
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/[email protected]
- name: Install R dependencies
uses: r-lib/actions/[email protected]
with:
packages: |
any::roxygen2
github::Genentech/rd2markdown
- name: Install packages
run: |
cd clients/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 "TS_DOCS_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
else
echo "TS_DOCS_VERSION=latest" >> $GITHUB_ENV
fi
- name: Build docs
run: |
cd docs/
export TS_DOCS_VERSION=$TS_DOCS_VERSION
make html
- name: Check out github
uses: actions/checkout@v4
with:
path: docs/_build/ts-docs
ref: gh-pages
- name: Commit html docs
run: |
cd docs/_build/
ls
rm -rf ts-docs/$TS_DOCS_VERSION
cp -r html ts-docs/$TS_DOCS_VERSION
cd ts-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/ts-docs
force: true