name: Documentation
on:
push:
branches: [main]
paths:
- "docs/**"
- "README.md"
- "CHANGELOG.md"
- ".github/workflows/docs.yml"
pull_request:
branches: [main]
paths:
- "docs/**"
- "README.md"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build-docs:
name: Build Documentation
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"
- name: ✅ Verify Installation
run: |
echo "📦 Testing package import..."
python -c "import sys; print(f'Python {sys.version}')"
continue-on-error: false
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e . || pip install -e .[test] || echo "Package installation failed, continuing with minimal setup"
pip install mkdocs mkdocs-material mkdocstrings[python] || echo "Some docs dependencies failed, continuing..."
continue-on-error: true
- name: ✅ Verify Installation
run: |
echo "📦 Testing package import..."
python -c "import simplenote_mcp; print('✅ Package import successful')" || echo "⚠️ Package import failed, continuing..."
echo "🔧 Checking documentation tools..."
mkdocs --version || echo "⚠️ MkDocs not found, will create basic structure"
continue-on-error: true
- name: ✅ Verify Documentation Tools
run: |
echo "🔧 Verifying documentation setup..."
mkdocs --version && echo "✅ MkDocs available" || echo "⚠️ MkDocs not available"
ls -la mkdocs.yml && echo "✅ MkDocs config found" || echo "⚠️ No mkdocs.yml found"
ls -la docs/ && echo "✅ Docs directory found" || echo "⚠️ No docs directory"
continue-on-error: true
- name: Verify docs structure
run: |
echo "📁 Checking documentation structure..."
if [ ! -d docs ]; then
echo "⚠️ docs directory missing, but mkdocs.yml exists - this is OK"
else
echo "✅ docs directory found"
fi
if [ ! -f mkdocs.yml ]; then
echo "❌ mkdocs.yml missing - this should not happen"
exit 1
else
echo "✅ mkdocs.yml found"
fi
- name: Verify API documentation
run: |
echo "📋 Checking API documentation..."
if [ ! -d docs/api ]; then
echo "⚠️ docs/api directory missing, but should exist from repo"
else
echo "✅ docs/api directory found"
ls -la docs/api/
fi
- name: Verify documentation files
run: |
echo "📄 Checking documentation files..."
for file in docs/index.md docs/installation.md docs/configuration.md docs/usage.md docs/contributing.md docs/changelog.md; do
if [ -f "$file" ]; then
echo "✅ $file found"
else
echo "⚠️ $file missing"
fi
done
- name: Build documentation
run: mkdocs build
- name: Upload documentation artifacts
uses: actions/upload-pages-artifact@v4
with:
path: ./site
deploy-docs:
timeout-minutes: 12
name: Deploy Documentation
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
needs: build-docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Check GitHub Pages status
id: pages-check
run: |
echo "Checking if GitHub Pages is enabled..."
# This step will help diagnose the issue
echo "Repository: ${{ github.repository }}"
echo "Pages URL should be: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
continue-on-error: true
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
continue-on-error: true
- name: Handle deployment failure
if: failure()
run: |
echo "❌ GitHub Pages deployment failed"
echo "This is likely because GitHub Pages is not enabled for this repository"
echo "To enable GitHub Pages:"
echo "1. Go to: https://github.com/${{ github.repository }}/settings/pages"
echo "2. Under 'Source', select 'GitHub Actions'"
echo "3. Save the settings"
echo ""
echo "Documentation was built successfully and is available as an artifact"
exit 0 # Don't fail the entire workflow
link-check:
timeout-minutes: 8
name: Check Documentation Links
runs-on: ubuntu-latest
needs: build-docs
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Download documentation artifacts
uses: actions/download-artifact@v7
with:
name: github-pages
path: ./site
- name: Extract site
run: |
cd site
tar -xf artifact.tar
- name: Check links
uses: lycheeverse/lychee-action@v2
with:
args: --verbose --no-progress --config .lycheerc.toml './site/**/*.html' --exclude-mail
fail: false # Don't fail workflow on link issues, just report them
failIfEmpty: false # Don't fail if no links found
output: lychee-report.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Upload link check report
if: always()
uses: actions/upload-artifact@v6
with:
name: link-check-report
path: lychee-report.md
retention-days: 7