name: Documentation
on:
push:
branches: [ main ]
paths:
- 'src/**'
- 'docs/**'
- 'README.md'
- 'AUTHENTICATION_GUIDE.md'
pull_request:
branches: [ main ]
paths:
- 'src/**'
- 'docs/**'
- 'README.md'
- 'AUTHENTICATION_GUIDE.md'
jobs:
docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install sphinx sphinx-rtd-theme sphinx-autodoc-typehints myst-parser
- name: Create docs directory structure
run: |
mkdir -p docs/source
mkdir -p docs/build
- name: Generate API documentation
run: |
sphinx-apidoc -o docs/source src/
- name: Create Sphinx configuration
run: |
cat > docs/source/conf.py << 'EOF'
import os
import sys
sys.path.insert(0, os.path.abspath('../../src'))
project = 'Instagram MCP Server'
copyright = '2025, José Luis Badano'
author = 'José Luis Badano'
release = '1.0.0'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinx_autodoc_typehints',
'myst_parser',
]
templates_path = ['_templates']
exclude_patterns = []
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
autodoc_default_options = {
'members': True,
'member-order': 'bysource',
'special-members': '__init__',
'undoc-members': True,
'exclude-members': '__weakref__'
}
napoleon_google_docstring = True
napoleon_numpy_docstring = True
napoleon_include_init_with_doc = False
napoleon_include_private_with_doc = False
EOF
- name: Create main documentation index
run: |
cat > docs/source/index.rst << 'EOF'
Instagram MCP Server Documentation
==================================
Welcome to the Instagram MCP Server documentation!
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
EOF
- name: Build documentation
run: |
cd docs
sphinx-build -b html source build/html
- name: Upload documentation artifacts
uses: actions/upload-artifact@v5
with:
name: documentation
path: docs/build/html/
deploy-docs:
name: Deploy Documentation
runs-on: ubuntu-latest
needs: docs
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v5
- name: Download documentation artifacts
uses: actions/download-artifact@v6
with:
name: documentation
path: docs/
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/
cname: ig-mcp.jlbadano.dev # Optional: your custom domain
link-check:
name: Check Documentation Links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Create link check config
run: |
mkdir -p .github
cat > .github/markdown-link-check-config.json << 'EOF'
{
"ignorePatterns": [
{
"pattern": "^http://localhost"
},
{
"pattern": "^https://localhost"
},
{
"pattern": "^https://mseep.ai/app/7bde8131-7019-405f-89d1-cef574a8129a"
}
],
"timeout": "20s",
"retryOn429": true,
"retryCount": 3,
"fallbackHttpStatus": [
400,
401,
403,
404,
500,
502,
503
]
}
EOF
- name: Check links in README
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
config-file: '.github/markdown-link-check-config.json'