Merge pull request #15 from Smithsonian/apidocs #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: API Documentation | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- 'docs/**' | |
- '.github/workflows/docs.yml' | |
pull_request: | |
paths: | |
- 'src/**' | |
- 'docs/**' | |
- '.github/workflows/docs.yml' | |
jobs: | |
apidocs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out smax-python | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Sphinx and RTM theme | |
run: pip install sphinx sphinx-rtd-theme | |
- name: Build docs | |
run: | | |
cd docs | |
sphinx-apidoc -o . ../src/smax | |
sphinx-build -M html . . | |
- name: Checkout gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: 'gh-pages' | |
path: site | |
- name: copy docs to gh-pages | |
run: cp -a docs/html/* site/ | |
- name: Push to pages | |
run: | | |
cd site | |
git config --global user.email "$GITHUB_JOB+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions" | |
git add -A | |
git commit -m "[automated site update]" && git push || true |