Skip to content

Merge pull request #66 from CU-ESIIL/codex/install-mkdocstrings-plugin #24

Merge pull request #66 from CU-ESIIL/codex/install-mkdocstrings-plugin

Merge pull request #66 from CU-ESIIL/codex/install-mkdocstrings-plugin #24

Workflow file for this run

name: Deploy MkDocs site to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then
python -m pip install -r requirements.txt
else
python -m pip install mkdocs
fi
- name: Build MkDocs site
run: mkdocs build --strict --clean --site-dir dist
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
with:
enablement: true
continue-on-error: true
- name: Verify Pages is enabled
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
api_url="https://api.github.com/repos/${GITHUB_REPOSITORY}/pages"
status="$(curl -sS -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/vnd.github+json" -o /tmp/pages-response.json -w "%{http_code}" "${api_url}")"
if [ "${status}" = "404" ]; then
echo "::error::Enable GitHub Pages: Settings → Pages → Source = GitHub Actions and Settings → Actions → Workflow permissions = Read and write."
exit 1
elif [ "${status}" != "200" ]; then
echo "::error::Failed to verify GitHub Pages (HTTP ${status})."
cat /tmp/pages-response.json
exit 1
fi
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4