Skip to content

Commit 5f02998

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

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/docs.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
python -m pip install --upgrade pip
40+
cd docs
41+
python -m pip install -U -r requirements.txt
42+
- name: Build Sphinx Documentation
43+
run: |
44+
cd docs
45+
make html
46+
- name: Upload the docs as an artifact
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: khisto-python-docs
50+
path: ./docs/_build/html/
51+
# Publish to GH pages on Git tag and manually
52+
publish:
53+
if: github.ref_type == 'tag' && github.event_name == 'workflow_dispatch' && inputs.deploy-gh-pages == true
54+
needs: build
55+
runs-on: ubuntu-22.04
56+
permissions:
57+
contents: write
58+
steps:
59+
- name: Download the docs artifact
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: khisto-python-docs
63+
path: ./docs/_build/html
64+
- name: Deploy web site
65+
run: |
66+
# Install tool for pushing to GH pages
67+
pip install ghp-import
68+
69+
# Push built site directory contents to GH pages
70+
ghp-import -m "Deployed ${GITHUB_SHA:0:7}" --push --force --no-jekyll ./docs/_build/html/

0 commit comments

Comments
 (0)