Update sphinx_branch.yml #28
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: GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'docs/**' # Trigger on changes in the docs directory | |
- '.github/workflows/sphinx_branch.yml' | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'docs/**' # Trigger on changes in the docs directory | |
- '.github/workflows/sphinx_branch.yml' | |
jobs: | |
deploy: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
python-version: ['3.10'] # List of Python versions to test against | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main # Check out the main branch | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Get pip cache dir | |
id: pip-cache | |
run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pip-cache.outputs.dir }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}-v2 | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: python -m pip install -r ./requirements.txt | |
- name: Install Sphinx and extensions | |
run: python -m pip install sphinx sphinx_rtd_theme sphinx-autodoc-typehints | |
- name: Print working directory | |
run: pwd | |
- name: List files in the current directory | |
run: ls -al | |
- name: Build Sphinx Documentation | |
run: sphinx-build -b html ./docs/source ./docs/_build/html | |
- name: Create .nojekyll file | |
run: | | |
touch ./.nojekyll | |
touch ./docs/_build/html/.nojekyll | |
touch ./docs/.nojekyll | |
- name: Deploy to gh-pages | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs/_build/html |