Merge pull request #250 from prjemian/249-dependencies #59
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: Publish Sphinx Docs to GitHub Pages | |
on: | |
# Build the docs on pushes to main branch, PRs to main branch, and new tags. | |
# Publish only on demand. | |
push: | |
branches: | |
- main | |
tags: | |
- '*' # all tags | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: # allow manual triggering | |
inputs: | |
deploy: | |
description: 'Deploy documentation' | |
type: boolean | |
required: true | |
default: false | |
jobs: | |
pages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy Information | |
if: ${{ github.event.inputs.deploy }} | |
run: | | |
echo "The docs will be published from this workflow run." | |
- name: Set timezone | |
uses: szenius/set-timezone@v2.0 | |
with: | |
timezoneLinux: "America/Chicago" | |
- name: Make Temporary Directory for Sphinx content | |
run: | | |
echo "SRC_DIR=$(pwd)" >> ${GITHUB_ENV} | |
echo "TMP_DIR=$(mktemp -d)" >> ${GITHUB_ENV} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install Sphinx build requirements | |
run: pip install -r ./docs/requirements.txt | |
- name: Install our package | |
run: | | |
pip install --no-deps -e . -vv | |
- name: Show Environment variables | |
run: | | |
echo "SRC_DIR=${SRC_DIR}" | |
echo "TMP_DIR=${TMP_DIR}" | |
- name: Sphinx | |
run: | | |
sphinx-build -M html ./docs/source "${TMP_DIR}/build" | |
- name: Define ... HTML_DIR | |
run: | | |
echo "HTML_DIR=${TMP_DIR}/build/html" >> ${GITHUB_ENV} | |
- name: Diagnostics | |
run: | | |
ls -lAFghR "${HTML_DIR}" | |
- name: Publish (push gh-pages branch) only on demand | |
uses: peaceiris/actions-gh-pages@v4 | |
if: ${{ github.event.inputs.deploy }} | |
with: | |
publish_branch: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ${{ env.HTML_DIR }} | |
force_orphan: true |