Skip to content

Comments

✨ Add fastapi cloud setup-ci#157

Open
savannahostrowski wants to merge 10 commits intofastapilabs:mainfrom
savannahostrowski:setup-ci
Open

✨ Add fastapi cloud setup-ci#157
savannahostrowski wants to merge 10 commits intofastapilabs:mainfrom
savannahostrowski:setup-ci

Conversation

@savannahostrowski
Copy link
Member

Closes https://github.com/fastapilabs/cloud/issues/2832

Some notes on the UX:

Preconditions (exit early if not met)

  • User must be logged in and app must be configured (i.e. already have a .fastapicloud/cloud.json) --> otherwise, users will see a message to log in or run fastapi deploy.
  • Git remote origin must exist and be a GitHub URL --> otherwise error

Happy Path UX

  1. Detect context — reads repo slug from git origin, detects default branch via git symbolic-ref refs/remote/origin/HEAD (falls back to main if the command fails)
  2. Display summary — shows repo and branch
  3. --dry-run — optional but if passed, prints what would happen and exits
  4. Create deploy token — calls the API to create (or regenerate if one already exists) a token named GitHub Actions — owner/repo
  5. Set GitHub secrets — two paths:
    • gh CLI available: sets FASTAPI_CLOUD_TOKEN and FASTAPI_CLOUD_APP_ID as repo secrets via gh secret set
    • gh CLI not found: prints the token value and app ID with a link to the repo's secrets page for manual setup
  6. Write workflow file (skipped with --secrets-only):
    • If deploy.yml already exists (and no --file flag): prompt to overwrite, enter a new name, or skip
    • If --file passed: writes to .github/workflows/<name>
    • Otherwise: writes to .github/workflows/deploy.yml
  7. Done! Show expiry date and reminds the user to regenerate before it expires

Available Flags:

  • --branch / -b — override deploy branch (default: main)
  • --secrets-only / -s — skip writing the workflow file, just set the secrets in the repo
  • --dry-run / -d — preview without changes
  • --file / -f — custom workflow filename
image

@savannahostrowski savannahostrowski added the feature New feature or request label Feb 18, 2026
Copy link
Collaborator

@patrick91 patrick91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, I left some comments, but I'm excited to see this in soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants