Skip to content

Commit bd5b49a

Browse files
authored
Add GitHub Actions workflow for VicUtils documentation
1 parent a9b0b84 commit bd5b49a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Generate VicUtils Docs
2+
3+
on:
4+
push:
5+
paths:
6+
- 'vicutils/**/*.py'
7+
branches:
8+
- main
9+
10+
jobs:
11+
generate-docs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.x'
19+
20+
- name: Install pdoc
21+
run: pip install pdoc3
22+
23+
- name: Generate documentation
24+
run: |
25+
cd vicutils
26+
for file in *.py; do
27+
if [ "$file" != "__init__.py" ]; then
28+
pdoc --html --force --output-dir . "${file%.py}"
29+
# Move generated HTML to parent directory name
30+
mv "${file%.py}"/index.html "${file%.py}.html" 2>/dev/null || true
31+
rm -rf "${file%.py}"
32+
fi
33+
done
34+
35+
- name: Commit and push if changes
36+
run: |
37+
git config user.name "Vic-Nas"
38+
git config user.email "github-actions@github.com"
39+
git add vicutils/*.html
40+
git diff --quiet && git diff --staged --quiet || (git commit -m "Auto-generate VicUtils documentation" && git push)

0 commit comments

Comments
 (0)