1 # CI / non-interactive deploys
2
3 `smb` is interactive by default — it prompts for confirmations, project setup,
4 credentials, and so on. In CI that's a problem: there's no TTY to answer a
5 prompt, so the command would hang or fail with a cryptic terminal error.
6
7 Pass the global **`--ci`** flag (or set **`SMB_CI=1`**, or run under any provider
8 that sets the conventional **`CI`** env var) to put `smb` in **non-interactive
9 mode**:
10
11 - Confirmations resolve to their default instead of asking
12 (e.g. `smb --ci logout` proceeds without a y/n prompt).
13 - Any command that genuinely needs interactive input — `login`, `init`,
14 `signup`, `account forgot-password`, `project new/update/delete`, and picking a
15 monorepo target — **fails fast with a clear, actionable message** instead of
16 blocking.
17
18 ```sh
19 smb --ci deploy # flag
20 SMB_CI=1 smb deploy # env var
21 CI=true smb deploy # most CI providers set this automatically
22 ```
23
24 ## Authenticate ahead of time
25
26 Logging in is interactive, so it can't run under `--ci`. Provision the token
27 once and make it available to the CI job at `~/.smb/token` (production) or
28 `~/.smb-dev/token` (dev). Typically you store the token contents in a CI secret
29 and write the file at the start of the job:
30
31 ```yaml
32 - run: |
33 mkdir -p ~/.smb
34 printf '%s' "${{ secrets.SMB_TOKEN }}" > ~/.smb/token
35 chmod 600 ~/.smb/token
36 ```
37
38 Deploys also rsync over SSH using `~/.ssh/id_<user-id>@smbcloud`; install that
39 key the same way if your project deploys to a server tier.
40
41 ## Example: the AircraftsHub monorepo
42
43 [AircraftsHub](https://aircraftshub.5mb.app) is a Tauri app whose Next.js web app
44 lives in the same repo (`web/`) as a pnpm workspace. Only the web app deploys to
45 smbCloud; the desktop/mobile app ships to the app stores. Its `.smb/config.toml`:
46
47 ```toml
48 name = "aircraftshubweb"
49
50 [project]
51 id = 61
52 kind = "nextjs-ssr"
53 source = "web" # local Next.js app directory (workspace member)
54 path = "apps/web/aircraftshubweb" # remote runtime directory on the server
55 package_manager = "pnpm"
56 pm2_app = "aircraftshub-web"
57 port = 3022
58 ```
59
60 Because the config pins the project, the source, and the runtime, deploying needs
61 no interaction at all:
62
63 ```sh
64 smb --ci deploy
65 # ✔ Build complete.
66 # App is running ✔
67 # ✔ Deployment complete.
68 ```
69
70 For a monorepo config with several `[[projects]]` entries, name the target —
71 `--ci` mode won't prompt you to choose:
72
73 ```sh
74 smb --ci deploy --project aircraftshubweb
75 ```
76
77 ## Behavior reference
78
79 | Command | `--ci` behavior |
80 |---|---|
81 | `deploy` (config pins project) | Runs fully non-interactively |
82 | `deploy` (monorepo, no `--project`) | Fails: pass `--project <name>` |
83 | `deploy` (not authenticated) | Fails: provision the token first |
84 | `logout` | Proceeds (confirmation defaults to yes) |
85 | `login`, `init`, `signup`, `account forgot-password` | Fails fast — interactive only |
86 | `project new`, `project update`, `project delete` | Fails fast — interactive only |
87 | `me`, `migrate`, `project list/show`, `mail` | Unaffected (no prompts) |