Skip to content

Setup CI Command

The fastapi cloud setup-ci command configures GitHub Actions for continuous deployment of your FastAPI Cloud application. It creates a deploy token, sets the required GitHub secrets, and writes a workflow file — all in one step.

Terminal window
fastapi cloud setup-ci [OPTIONS]

Options:

  • --branch, -b - Override the deploy branch (default: main)
  • --secrets-only, -s - Set secrets only, skip writing the workflow file
  • --dry-run, -d - Preview what would happen without making changes
  • --file, -f - Custom workflow filename (written to .github/workflows/<name>)
Terminal window
fastapi cloud setup-ci
Terminal window
fastapi cloud setup-ci --branch production
Terminal window
fastapi cloud setup-ci --dry-run
Terminal window
fastapi cloud setup-ci --secrets-only

Useful if you already have a workflow file and only need to (re)create the secrets.

Terminal window
fastapi cloud setup-ci --file deploy-prod.yml

When you run fastapi cloud setup-ci, the CLI will:

  1. Read your repo slug from the Git remote and detect the default branch
  2. Display a summary of what will be configured
  3. Create (or regenerate) a deploy token named GitHub Actions — owner/repo
  4. Set FASTAPI_CLOUD_TOKEN and FASTAPI_CLOUD_APP_ID as GitHub repo secrets:
    • If the gh CLI is available: secrets are set automatically via gh secret set
    • If the gh CLI is not found: the token value and app ID are printed along with a link to your repo’s secrets page for manual setup
  5. Write a workflow file to .github/workflows/deploy.yml (unless --secrets-only is passed) — see the GitHub Actions example for the generated workflow

Workflow file conflicts — If deploy.yml already exists and no --file flag was passed, you’ll be prompted to overwrite it, enter a new filename, or skip.

Token expiry — The deploy token is valid for 365 days. The expiration date is shown at the end of the command output. To regenerate it, re-run this command or use the dashboard.

You need to log in first:

Terminal window
fastapi login

Deploy your application first to create the configuration:

Terminal window
fastapi deploy

The command requires a GitHub URL as the origin remote. Verify with:

Terminal window
git remote get-url origin
  • fastapi deploy - Deploy your app (required before using this command)
  • fastapi login - Authenticate with FastAPI Cloud