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.
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>)
Examples
Section titled “Examples”Run with Defaults
Section titled “Run with Defaults”fastapi cloud setup-ciTarget a Specific Branch
Section titled “Target a Specific Branch”fastapi cloud setup-ci --branch productionPreview Without Making Changes
Section titled “Preview Without Making Changes”fastapi cloud setup-ci --dry-runSet Secrets Only
Section titled “Set Secrets Only”fastapi cloud setup-ci --secrets-onlyUseful if you already have a workflow file and only need to (re)create the secrets.
Use a Custom Workflow Filename
Section titled “Use a Custom Workflow Filename”fastapi cloud setup-ci --file deploy-prod.ymlWhat This Command Does
Section titled “What This Command Does”When you run fastapi cloud setup-ci, the CLI will:
- Read your repo slug from the Git remote and detect the default branch
- Display a summary of what will be configured
- Create (or regenerate) a deploy token named
GitHub Actions — owner/repo - Set
FASTAPI_CLOUD_TOKENandFASTAPI_CLOUD_APP_IDas GitHub repo secrets:- If the
ghCLI is available: secrets are set automatically viagh secret set - If the
ghCLI is not found: the token value and app ID are printed along with a link to your repo’s secrets page for manual setup
- If the
- Write a workflow file to
.github/workflows/deploy.yml(unless--secrets-onlyis passed) — see the GitHub Actions example for the generated workflow
Important Notes
Section titled “Important Notes”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.
Troubleshooting
Section titled “Troubleshooting”Error: No credentials found
Section titled “Error: No credentials found”You need to log in first:
fastapi loginError: No app found
Section titled “Error: No app found”Deploy your application first to create the configuration:
fastapi deployError: No GitHub remote found
Section titled “Error: No GitHub remote found”The command requires a GitHub URL as the origin remote. Verify with:
git remote get-url originRelated Commands
Section titled “Related Commands”fastapi deploy- Deploy your app (required before using this command)fastapi login- Authenticate with FastAPI Cloud