Add sphinx doc #5
Workflow file for this run
This file contains hidden or 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: Docs | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| paths: | |
| - docs/**.rst | |
| - docs/conf.py | |
| - docs/make.bat | |
| - docs/Makefile | |
| - docs/requirements.txt | |
| - docs/_static/**.css | |
| - src/khisto/**.py | |
| - .github/workflows/docs.yml | |
| push: | |
| tags: ['*'] | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| id-token: write | |
| packages: read | |
| pages: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest | |
| # queued. However, do NOT cancel in-progress runs as we want to allow these production deployments | |
| # to complete. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout khisto-python | |
| uses: actions/checkout@v4 | |
| - name: Add pip scripts directory to path | |
| run: echo PATH="$PATH:/github/home/.local/bin" >> "$GITHUB_ENV" | |
| - name: Install doc build requirements | |
| run: | | |
| set +e | |
| python -m pip install --upgrade pip | |
| cd docs | |
| ls -la | |
| python -m pip install -U -r requirements.txt | |
| - name: Build Sphinx Documentation | |
| run: | | |
| cd docs | |
| make html | |
| - name: Upload the docs as an artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: khisto-python-docs | |
| path: ./docs/_build/html/ | |
| # Publish to GH pages on Git tag and manually | |
| publish: | |
| if: github.ref_type == 'tag' && github.event_name == 'workflow_dispatch' && inputs.deploy-gh-pages == true | |
| needs: build | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download the docs artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: khisto-python-docs | |
| path: ./docs/_build/html | |
| - name: Deploy web site | |
| run: | | |
| # Install tool for pushing to GH pages | |
| pip install ghp-import | |
| # Push built site directory contents to GH pages | |
| ghp-import -m "Deployed ${GITHUB_SHA:0:7}" --push --force --no-jekyll ./docs/_build/html/ |