Skip to content

ci: Enhance GitHub Actions workflow for documentation deployment #8

ci: Enhance GitHub Actions workflow for documentation deployment

ci: Enhance GitHub Actions workflow for documentation deployment #8

Workflow file for this run

name: Deploy MkDocs
on:
push:
branches:
- main
paths:
- 'docs/**'
- 'mkdocs.yml'
- '.github/workflows/deploy-docs.yml'
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
# Set up Python and cache dependencies
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
cache: pip
cache-dependency-path: docs/requirements.txt
# Install Python dependencies
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
# Set up Node.js and cache dependencies
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: docs/package-lock.json
# Install Node.js dependencies
- name: Install Node.js dependencies
working-directory: ./docs
run: npm ci || npm install
# Lint Markdown files (but don't fail the build)
- name: Lint Markdown files
working-directory: ./docs
run: npm run lint || echo "Lint check skipped, continuing deployment"
# Check for broken links or references (but don't fail the build)
- name: Check for broken links
run: |
cd docs
npm run links || echo "Link check found issues, review logs for details"
continue-on-error: true
# Build and validate documentation
- name: Build documentation with validation
run: mkdocs build --strict
# Deploy to GitHub Pages using mkdocs
- name: Deploy to GitHub Pages
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
mkdocs gh-deploy --force
# Verify deployment
- name: Verify deployment
run: |
echo "Documentation deployed to GitHub Pages"
echo "Visit https://mitre.github.io/kube-cinc-secure-scanner/ to view the documentation"