Build Docs workflow (nunchaku-ai/ComfyUI-nunchaku)
The Build Docs workflow from nunchaku-ai/ComfyUI-nunchaku, explained and optimized by Latchkey.
CI health: A - excellent
Run this on Latchkey for self-healing, caching, and up to 58% lower cost.
Grade your own workflow free or run it on Latchkey →What it does
This is the Build Docs workflow from the nunchaku-ai/ComfyUI-nunchaku repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
name: Build Docs
on:
schedule:
- cron: '30 7 * * *' # UTC time
workflow_dispatch:
inputs:
version:
description: 'Docs version (default: nightly)'
required: false
default: 'nightly'
jobs:
build-and-deploy-docs:
name: Build and deploy docs
runs-on: [self-hosted, build-docs]
if: github.event_name != 'workflow_dispatch' || github.actor == 'lmxyy'
env:
DOC_VERSION: ${{ github.event.inputs.version || 'nightly' }}
steps:
- name: Checkout dev branch
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: dev
- name: Show current commit
run: git log -1 --oneline
- name: Set up Python
run: |
which python
echo "Setting up Python with Conda"
conda create -n nunchaku-docs python=3.12 -y
- name: Install Nunchaku
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; }
which python
conda install -c conda-forge gxx=11 gcc=11 libsndfile -y
pip install uv
echo "Installing dependencies"
cd ..
git clone https://github.com/nunchaku-ai/nunchaku.git
cd nunchaku
git log -1 --oneline
git submodule init
git submodule update
uv pip install -e ".[dev,docs]"
- name: Install ComfyUI
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; }
which python
uv pip install -e ".[dev,docs]"
- name: Build docs
run: |
source $(conda info --base)/etc/profile.d/conda.sh
conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; }
which python
cd docs
make html
- name: Deploy docs
run: |
echo "${{ secrets.DO_SSH_KEY }}" > ./id_rsa
chmod 600 id_rsa
source $(conda info --base)/etc/profile.d/conda.sh
conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; }
which python
rsync -avz --delete docs/build/html/ ${{ secrets.DO_USER }}@${{ secrets.DO_HOST }}:${{ secrets.DO_DOCS_ROOT }}/ComfyUI-nunchaku-${{ env.DOC_VERSION }}
rm id_rsa
env:
RSYNC_RSH: "ssh -o StrictHostKeyChecking=no -i id_rsa"
- name: Clean up
if: always()
run: |
cd ..
rm -rf nunchaku
The same workflow, on Latchkey
Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.
name: Build Docs on: schedule: - cron: '30 7 * * *' # UTC time workflow_dispatch: inputs: version: description: 'Docs version (default: nightly)' required: false default: 'nightly' jobs: build-and-deploy-docs: timeout-minutes: 30 name: Build and deploy docs runs-on: [self-hosted, build-docs] if: github.event_name != 'workflow_dispatch' || github.actor == 'lmxyy' env: DOC_VERSION: ${{ github.event.inputs.version || 'nightly' }} steps: - name: Checkout dev branch uses: actions/checkout@v4 with: fetch-depth: 0 ref: dev - name: Show current commit run: git log -1 --oneline - name: Set up Python run: | which python echo "Setting up Python with Conda" conda create -n nunchaku-docs python=3.12 -y - name: Install Nunchaku run: | source $(conda info --base)/etc/profile.d/conda.sh conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; } which python conda install -c conda-forge gxx=11 gcc=11 libsndfile -y pip install uv echo "Installing dependencies" cd .. git clone https://github.com/nunchaku-ai/nunchaku.git cd nunchaku git log -1 --oneline git submodule init git submodule update uv pip install -e ".[dev,docs]" - name: Install ComfyUI run: | source $(conda info --base)/etc/profile.d/conda.sh conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; } which python uv pip install -e ".[dev,docs]" - name: Build docs run: | source $(conda info --base)/etc/profile.d/conda.sh conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; } which python cd docs make html - name: Deploy docs run: | echo "${{ secrets.DO_SSH_KEY }}" > ./id_rsa chmod 600 id_rsa source $(conda info --base)/etc/profile.d/conda.sh conda activate nunchaku-docs || { echo "Failed to activate conda env"; exit 1; } which python rsync -avz --delete docs/build/html/ ${{ secrets.DO_USER }}@${{ secrets.DO_HOST }}:${{ secrets.DO_DOCS_ROOT }}/ComfyUI-nunchaku-${{ env.DOC_VERSION }} rm id_rsa env: RSYNC_RSH: "ssh -o StrictHostKeyChecking=no -i id_rsa" - name: Clean up if: always() run: | cd .. rm -rf nunchaku
What changed
- Add a job timeout so a hung step cannot burn hours of runner time.
What Latchkey heals here
This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:
- Dependency installs
This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.