| 1 | # smbCloud Deploy Action |
| 2 | |
| 3 | [](https://github.com/marketplace/actions/smbcloud-deploy) |
| 4 | [](https://github.com/smbcloudXYZ/smbcloud-deploy-action/actions/workflows/lint.yml) |
| 5 | [](LICENSE) |
| 6 | |
| 7 | A composite GitHub Action that installs the [smbCloud CLI](https://github.com/smbcloudXYZ/smbcloud-cli) |
| 8 | (`smb`) and deploys your app non-interactively from CI. |
| 9 | |
| 10 | It wraps the CLI's `--ci` (non-interactive) deploy flow: provision a token, |
| 11 | optionally install an SSH key, then run `smb --ci deploy`. Your `.smb/config.toml` |
| 12 | picks the deploy strategy (`nextjs-ssr`, `vite-spa`, `rails`, `rust`, `swift`, or |
| 13 | generic rsync/git), so the same step works for any stack. |
| 14 | |
| 15 | ## Quick start |
| 16 | |
| 17 | ```yaml |
| 18 | name: Deploy |
| 19 | on: |
| 20 | push: |
| 21 | branches: [main] |
| 22 | |
| 23 | jobs: |
| 24 | deploy: |
| 25 | runs-on: ubuntu-latest |
| 26 | steps: |
| 27 | - uses: actions/checkout@v7 |
| 28 | - uses: smbcloudXYZ/smbcloud-deploy-action@v1 |
| 29 | with: |
| 30 | token: ${{ secrets.SMB_TOKEN }} |
| 31 | ``` |
| 32 | |
| 33 | That installs the latest CLI, writes the token, and runs `smb --ci deploy` |
| 34 | against the project pinned in your `.smb/config.toml`. |
| 35 | |
| 36 | ## Monorepo |
| 37 | |
| 38 | For a monorepo config with several `[[projects]]` entries, name the target. |
| 39 | Non-interactive mode won't prompt you to choose: |
| 40 | |
| 41 | ```yaml |
| 42 | - uses: smbcloudXYZ/smbcloud-deploy-action@v1 |
| 43 | with: |
| 44 | token: ${{ secrets.SMB_TOKEN }} |
| 45 | project: my-web-app |
| 46 | ``` |
| 47 | |
| 48 | ## SSH / rsync deploys |
| 49 | |
| 50 | Deploy paths that upload over rsync need the account-scoped SSH key. smbCloud |
| 51 | expects it at `~/.ssh/id_<user-id>@smbcloud`: |
| 52 | |
| 53 | ```yaml |
| 54 | - uses: smbcloudXYZ/smbcloud-deploy-action@v1 |
| 55 | with: |
| 56 | token: ${{ secrets.SMB_TOKEN }} |
| 57 | ssh-private-key: ${{ secrets.SMB_SSH_KEY }} |
| 58 | ssh-key-name: id_<user-id>@smbcloud |
| 59 | ssh-known-hosts: ${{ secrets.SMB_KNOWN_HOSTS }} |
| 60 | ``` |
| 61 | |
| 62 | Pin `ssh-known-hosts` instead of disabling host-key checking. |
| 63 | |
| 64 | ## Inputs |
| 65 | |
| 66 | | Input | Required | Default | Description | |
| 67 | | ------------------- | -------- | ------------------------ | ---------------------------------------------------------------------------------------------------- | |
| 68 | | `token` | yes | _(required)_ | smbCloud auth token contents (from a CI secret). Written to the CLI state dir to authenticate `smb`. | |
| 69 | | `environment` | no | `production` | `production` or `dev`. Selects API host and state dir (`.smb` vs `.smb-dev`). | |
| 70 | | `project` | no | `""` | Monorepo sub-project name (the `name` in a `[[projects]]` entry). | |
| 71 | | `working-directory` | no | `.` | Directory containing `.smb/config.toml`. | |
| 72 | | `version` | no | `latest` | CLI version to install (e.g. `0.5.0`, `v0.5.0`, or `latest`). | |
| 73 | | `ssh-private-key` | no | `""` | SSH private key contents for rsync/SSH deploys. | |
| 74 | | `ssh-key-name` | no | `""` | Filename under `~/.ssh` for the key. Required when `ssh-private-key` is set. | |
| 75 | | `ssh-known-hosts` | no | `""` | Entries appended to `~/.ssh/known_hosts`. | |
| 76 | | `args` | no | `""` | Extra arguments appended to `smb deploy`. | |
| 77 | | `cli-repository` | no | `smbcloudXYZ/smbcloud-cli` | Repository to download the CLI binary from. | |
| 78 | |
| 79 | ## Outputs |
| 80 | |
| 81 | | Output | Description | |
| 82 | | ---------- | ---------------------------------------- | |
| 83 | | `smb-path` | Absolute path to the installed `smb` binary. | |
| 84 | | `version` | Resolved CLI version that was installed. | |
| 85 | |
| 86 | After this step runs, `smb` is on `PATH` and authenticated, so later steps can |
| 87 | call it directly (e.g. `smb me`, `smb migrate`). |
| 88 | |
| 89 | ## How it works |
| 90 | |
| 91 | 1. **Install.** Downloads the prebuilt `smb-<os>-<arch>` release binary for the |
| 92 | runner, makes it executable, and adds it to `PATH`. Works on Linux, macOS, and |
| 93 | Windows runners (amd64/arm64). |
| 94 | 2. **Configure.** Writes the token to `~/.smb/token` (production) or |
| 95 | `~/.smb-dev/token` (dev) with `600` perms, then installs the SSH key and |
| 96 | `known_hosts` if you passed them. |
| 97 | 3. **Deploy.** Runs `smb --ci --environment <env> deploy [--project <name>]` in |
| 98 | `working-directory`. The exit code propagates, so a failed deploy fails the job. |
| 99 | |
| 100 | ## Provisioning the token |
| 101 | |
| 102 | Logging in is interactive and cannot run under `--ci`, so provision the token |
| 103 | ahead of time and store its contents in a CI secret. See |
| 104 | [`docs/ci.md`](https://github.com/smbcloudXYZ/smbcloud-cli/blob/main/docs/ci.md) |
| 105 | in the CLI repo for token setup and the full non-interactive behavior reference. |
| 106 | |
| 107 | ## License |
| 108 | |
| 109 | [Apache-2.0](LICENSE) |