Merge pull request #83 from FNBBDevs/dev #65
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: Generate Sphinx Documentation | |
# Add permissions configuration | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install sphinx sphinx-rtd-theme | |
- name: Setup Sphinx documentation structure | |
run: | | |
mkdir -p docs | |
cd docs | |
if [ ! -f "conf.py" ]; then | |
sphinx-quickstart -q -p "bruhanimate" -a "Ethan Christensen" -v 1.0 -r 1.0 -l en --ext-autodoc --ext-viewcode --makefile --batchfile --sep | |
echo "import os" >> conf.py | |
echo "import sys" >> conf.py | |
echo "sys.path.insert(0, os.path.abspath('..'))" >> conf.py | |
echo "html_theme = 'sphinx_rtd_theme'" >> conf.py | |
echo "extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.napoleon']" | |
if [ ! -f "index.rst" ]; then | |
echo "bruhanimate documentation" > index.rst | |
echo "Welcome to Your Project's documentation!" >> index.rst | |
echo "=====================================" >> index.rst | |
echo "" >> index.rst | |
echo ".. toctree::" >> index.rst | |
echo " :maxdepth: 2" >> index.rst | |
echo " :caption: bruhanimate:" >> index.rst | |
echo "" >> index.rst | |
echo " bruhanimate.bruhutil" >> index.rst | |
echo " bruhanimate.bruheffect" >> index.rst | |
echo " bruhanimate.bruhrenderer" >> index.rst | |
fi | |
fi | |
- name: Generate .rst files with sphinx-apidoc | |
run: | | |
sphinx-apidoc -o docs/source bruhanimate/ | |
- name: Generate Documentation | |
run: | | |
cd docs | |
make html | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/build/html |