debug workflow #53
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@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
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 "Your Project Name" -a "Your Name" -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 | |
if [ ! -f "index.rst" ]; then | |
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: Contents:" >> index.rst | |
echo "" >> index.rst | |
fi | |
fi | |
- name: Generate Documentation | |
run: | | |
cd docs | |
make html | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_build/html |