Skip to content

Commit 4174cdf

Browse files
committed
chore: add Sphinx documentation build and deploy workflow
1 parent c13c39b commit 4174cdf

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
name: Docs
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths:
7+
- docs/**.rst
8+
- docs/conf.py
9+
- docs/make.bat
10+
- docs/Makefile
11+
- docs/requirements.txt
12+
- docs/_static/**.css
13+
- src/khisto/**.py
14+
- .github/workflows/docs.yml
15+
push:
16+
tags: ['*']
17+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18+
permissions:
19+
contents: read
20+
id-token: write
21+
packages: read
22+
pages: write
23+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest
24+
# queued. However, do NOT cancel in-progress runs as we want to allow these production deployments
25+
# to complete.
26+
concurrency:
27+
group: pages
28+
cancel-in-progress: false
29+
jobs:
30+
build:
31+
runs-on: ubuntu-22.04
32+
steps:
33+
- name: Checkout khisto-python
34+
uses: actions/checkout@v4
35+
- name: Add pip scripts directory to path
36+
run: echo PATH="$PATH:/github/home/.local/bin" >> "$GITHUB_ENV"
37+
- name: Install doc build requirements
38+
run: |
39+
set +e
40+
python -m pip install --upgrade pip
41+
cd docs
42+
ls -la
43+
python -m pip install -U -r requirements.txt
44+
- name: Build Sphinx Documentation
45+
run: |
46+
cd docs
47+
make html
48+
- name: Upload the docs as an artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: khisto-python-docs
52+
path: ./docs/_build/html/
53+
# Publish to GH pages on Git tag and manually
54+
publish:
55+
if: github.ref_type == 'tag' && github.event_name == 'workflow_dispatch' && inputs.deploy-gh-pages == true
56+
needs: build
57+
runs-on: ubuntu-22.04
58+
permissions:
59+
contents: write
60+
steps:
61+
- name: Download the docs artifact
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: khisto-python-docs
65+
path: ./docs/_build/html
66+
- name: Deploy web site
67+
run: |
68+
# Install tool for pushing to GH pages
69+
pip install ghp-import
70+
71+
# Push built site directory contents to GH pages
72+
ghp-import -m "Deployed ${GITHUB_SHA:0:7}" --push --force --no-jekyll ./docs/_build/html/

0 commit comments

Comments
 (0)