selfdoc v0.15.1 /selfdoc.deploy
On this page

Deploy provider module with Cloudflare Pages and GitHub Pages backends for publishing built documentation sites from the selfdoc output directory.

#selfdoc.deploy

#selfdoc.deploy

Deploy providers for selfdoc documentation sites.

Supports:

  • Cloudflare Pages (via wrangler CLI)
  • GitHub Pages (via git force-push to gh-pages branch)

#DeployError

Raised when a deploy operation fails.

#_resolve_cloudflare_env

python
def _resolve_cloudflare_env()

Bridge CF_ env vars to CLOUDFLARE_ for wrangler.

Our canonical env var names use the CF_ prefix (CF_ACCOUNT_ID, CF_PAGES_API_TOKEN). Wrangler expects CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN. This function bridges the gap.

#deploy_cloudflare_pages

python
def deploy_cloudflare_pages(output_dir, project_name, version)

Deploy to Cloudflare Pages using the Wrangler CLI.

Requires wrangler (Cloudflare CLI) to be installed and authenticated (via wrangler login or CLOUDFLARE_API_TOKEN env var).

Args:

  • output_dir: Path to the built HTML output directory.
  • project_name: Cloudflare Pages project name.
  • version: Version string for the commit message.

Raises:

  • DeployError: If wrangler is not installed or the deploy fails.

#deploy_github_pages

python
def deploy_github_pages(output_dir, version)

Deploy to GitHub Pages by force-pushing output to gh-pages branch.

Uses a temporary directory to build a fresh commit without touching the current working tree. Creates a .nojekyll file to prevent Jekyll processing on GitHub.

Args:

  • output_dir: Path to the built HTML output directory.
  • version: Version string for the commit message.

Raises:

  • DeployError: If git operations fail or remote is unreachable.

#_run_git

python
def _run_git(args, cwd)

Run a git command in the given directory, raising DeployError on failure.