|
| 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