Skip to content

Commit f77c690

Browse files
authored
Add automated documentation generation workflow (generate-docs.yml)
- Created generate-docs.yml to automate the generation and updating of documentation using Sphinx or JSDoc. - Configured the workflow to run on every push to the main branch and weekly on Sundays at midnight (UTC). - Includes setup steps for both Python (Sphinx) and Node.js (JSDoc) environments. - Supports generating and deploying documentation for both Python and JavaScript projects. This workflow ensures that project documentation remains up-to-date automatically.
1 parent 2540233 commit f77c690

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Automated Documentation
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
generate-docs:
9+
name: Generate or Update Documentation
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# Checkout repository code
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
# Set up Node.js for JSDoc or Python for Sphinx
18+
- name: Set up Node.js
19+
if: ${{ contains(github.event.head_commit.message, 'js') }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '16'
23+
24+
- name: Set up Python
25+
if: ${{ contains(github.event.head_commit.message, 'py') }}
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: '3.10'
29+
30+
# Install dependencies for Sphinx or JSDoc
31+
- name: Install Sphinx dependencies
32+
if: ${{ contains(github.event.head_commit.message, 'sphinx') }}
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install sphinx sphinx-rtd-theme
36+
37+
- name: Install JSDoc dependencies
38+
if: ${{ contains(github.event.head_commit.message, 'jsdoc') }}
39+
run: npm install jsdoc
40+
41+
# Generate documentation
42+
- name: Generate Sphinx Documentation
43+
if: ${{ contains(github.event.head_commit.message, 'sphinx') }}
44+
run: |
45+
sphinx-build -b html docs/ build/
46+
47+
- name: Generate JSDoc Documentation
48+
if: ${{ contains(github.event.head_commit.message, 'jsdoc') }}
49+
run: |
50+
npx jsdoc -c jsdoc.conf.json
51+
52+
# Deploy documentation (optional)
53+
- name: Deploy Documentation
54+
if: always()
55+
run: |
56+
echo "Deploying generated documentation"
57+
# Add your deployment logic here (e.g., pushing to GitHub Pages)

0 commit comments

Comments
 (0)