ci: Simplify GitHub Pages deployment workflow #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Documentation Build and Deploy | |
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 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
cache: pip | |
cache-dependency-path: docs/requirements.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install mkdocs-material | |
pip install -r docs/requirements.txt | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
cache-dependency-path: docs/package-lock.json | |
- name: Install Node.js dependencies | |
working-directory: ./docs | |
run: npm ci || npm install | |
- name: Lint Markdown files | |
working-directory: ./docs | |
run: npm run lint || echo "Lint check skipped, continuing deployment" | |
continue-on-error: true | |
- name: Configure Git | |
run: | | |
git config --global user.name "${{ github.actor }}" | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Ensure .nojekyll file exists | |
run: | | |
touch docs/.nojekyll | |
touch .nojekyll | |
- name: Deploy documentation | |
run: | | |
mkdocs gh-deploy --force --clean --verbose | |
- name: Verify deployment | |
run: | | |
echo "Documentation deployed to GitHub Pages" | |
echo "Visit https://mitre.github.io/kube-secure-scanner/ to view the documentation" | |
echo "Note: It may take a few minutes for changes to propagate" |