Skip to content

chore: update GitHub workflows and funding configuration #4

chore: update GitHub workflows and funding configuration

chore: update GitHub workflows and funding configuration #4

Workflow file for this run

# Deploy docs to GitHub Pages (hivemind.rithul.dev)
# - On push to main: deploy "latest" from current main
# - On release published: deploy versioned docs from tag (e.g. 1.2.0)
name: Docs
on:
push:
branches: [main]
paths:
- ".github/workflows/docs.yml"
- "docs/**"
- "mkdocs.yml"
- "pyproject.toml"
- "requirements-docs.txt"
- "branding/**"
release:
types: [published]
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: docs
cancel-in-progress: false
jobs:
deploy-latest:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install docs dependencies
run: pip install -r requirements-docs.txt
- name: Get version
id: version
run: |
V=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
echo "version=$V" >> $GITHUB_OUTPUT
- name: Deploy latest to gh-pages
run: |
set -e
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Give mike a local gh-pages synced with remote so push is not rejected (remote may have CNAME from prior run)
git fetch origin gh-pages 2>/dev/null || true
if git show-ref -q refs/remotes/origin/gh-pages; then
git checkout -B gh-pages origin/gh-pages
git checkout -
fi
# Suppress Material's MkDocs 2.0 warning (we pin mkdocs<2)
run_filtered() {
set +e
out=$("$@" 2>&1)
s=$?
set -e
echo "$out" | grep -v -E "MkDocs 2\.0|backward-incompatible|plugin system|theming system|No migration path|Closed contribution|Currently unlicensed|Our full analysis|squidfunk\.github\.io/mkdocs-material/blog" || true
return $s
}
run_filtered mike deploy --push --update-aliases "${{ steps.version.outputs.version }}" latest
run_filtered mike set-default --push latest
- name: Ensure CNAME on gh-pages
run: |
git clone --branch gh-pages "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages-out
cd gh-pages-out
echo "hivemind.rithul.dev" > CNAME
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add CNAME
git diff --staged --quiet || (git commit -m "chore(docs): ensure CNAME for custom domain" && git push)
deploy-version:
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install docs dependencies
run: pip install -r requirements-docs.txt
- name: Parse version from tag
id: version
run: |
V="${GITHUB_REF#refs/tags/v}"
echo "version=$V" >> $GITHUB_OUTPUT
- name: Deploy versioned docs to gh-pages
run: |
set -e
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Give mike a local gh-pages synced with remote so push is not rejected
git fetch origin gh-pages 2>/dev/null || true
if git show-ref -q refs/remotes/origin/gh-pages; then
git checkout -B gh-pages origin/gh-pages
git checkout -
fi
# Suppress Material's MkDocs 2.0 warning (we pin mkdocs<2)
run_filtered() {
set +e
out=$("$@" 2>&1)
s=$?
set -e
echo "$out" | grep -v -E "MkDocs 2\.0|backward-incompatible|plugin system|theming system|No migration path|Closed contribution|Currently unlicensed|Our full analysis|squidfunk\.github\.io/mkdocs-material/blog" || true
return $s
}
run_filtered mike deploy --push "${{ steps.version.outputs.version }}"
run_filtered mike alias --push "${{ steps.version.outputs.version }}" stable
- name: Ensure CNAME on gh-pages
run: |
git clone --branch gh-pages "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" gh-pages-out
cd gh-pages-out
echo "hivemind.rithul.dev" > CNAME
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add CNAME
git diff --staged --quiet || (git commit -m "chore(docs): ensure CNAME for custom domain" && git push)