Merge pull request #47 from SiHhangChen/2.0 #25
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: documentation | |
on: [push, pull_request, workflow_dispatch] | |
permissions: | |
contents: write | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
pip install sphinx sphinx_rtd_theme myst_parser | |
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 | |
pip install -e . | |
- name: Sphinx build | |
run: | | |
rm Makefile | |
(echo n; echo docs; echo FeiWang; echo v2.0; echo en) | sphinx-quickstart | |
sed -i "s/extensions = \[\]/extensions = \['sphinx.ext.napoleon','sphinx.ext.autodoc','sphinx.ext.doctest','sphinx.ext.githubpages',\]/g" conf.py | |
sed -i "s/html_theme = 'alabaster'/html_theme = 'sphinx_rtd_theme'/g" conf.py | |
sed -i "/^html_theme/a\autodoc_member_order = 'bysource'" conf.py | |
sphinx-apidoc -o src EduCDM | |
sphinx-build . _build | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/2.0' }} | |
with: | |
publish_branch: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: _build/ | |
force_orphan: true |