Skip to main content
Promote the current draft of a page in the active workspace to live. Visitors see the new version immediately on the next request. This page covers the synopsis, what the server-side promotion does, and the exit codes a CI step should branch on.

Synopsis

gavai publish <id>

Arguments

Flags

Run gavai publish --help for the authoritative flag list, including whether the page ID may also be passed as a flag in this version of the CLI.

Behavior

The command calls POST /v1/workspaces/{slug}/pages-publish against the active workspace. The server snapshots the current draft, writes it as the new live version, and invalidates the edge cache for that page. The response includes the publish timestamp and the number of page drafts promoted; the CLI prints it as JSON. For the underlying endpoint’s full contract, see the Pages API reference.
This writes to the live site immediately. For experimentation, run gavai patch against a test workspace, verify the draft with gavai get, and only then publish to production.

Examples

Publish a single page:
gavai publish page_01HXR8K2M4
Publish from CI after a successful build, branching on the exit code:
if gavai patch page_01HXR8K2M4 --ops dist/patches.json; then
  gavai publish page_01HXR8K2M4
else
  echo "Patch rejected — leaving live version unchanged" >&2
  exit 1
fi

Exit codes

See CLI overview — exit codes for the full table.