1 name: Deploy docs
2
3 # Deploys the docs website (website/, the `docs` sub-project in the monorepo's
4 # .smb config) to smbCloud via the smbcloud-deploy-action.
5 #
6 # `smb deploy` builds the Next.js site on the runner before rsyncing it, so this
7 # job sets up Node + pnpm first. The site's prebuild step generates
8 # content/developer/ from the sibling docs/ tree, so the full repo must be
9 # checked out (both website/ and docs/ are present here).
10 #
11 # Required repo configuration (Settings → Secrets and variables → Actions).
12 # None of these live in the repo — the public source carries no IDs/credentials
13 # (see CLAUDE.md, open-source boundary) and .smb/config.toml is gitignored, so
14 # the deploy target is materialized below from CI config:
15 #
16 # Secrets
17 # SMB_TOKEN smbCloud auth token contents (provision once; see docs/ci.md)
18 # SMB_SSH_PRIVATE_KEY Private key for rsync/SSH deploy (the account-scoped deploy key)
19 # SMB_SSH_KEY_NAME Key filename smb expects: id_<user-id>@smbcloud
20 # SMB_SSH_KNOWN_HOSTS known_hosts entry for the deploy host
21 # SMB_DOCS_FRONTEND_APP_ID The docs App's frontend_app_id
22 # Variables
23 # SMB_DOCS_PROJECT_ID The workspace (project) id
24 #
25 # Trigger: pushes to main that touch the docs, plus manual runs. Adjust the
26 # branch to your release flow; workflow_dispatch lets you run it from any branch.
27 #
28 # NOTE: the action installs the latest published CLI release and runs it with
29 # `--ci`. That flag must exist in the installed release, so this requires a
30 # published smbcloud-cli release that includes `--ci` (pin a specific version
31 # below if `latest` ever regresses).
32
33 on:
34 push:
35 branches: [main]
36 paths:
37 - 'website/**'
38 - 'docs/**'
39 - '.github/workflows/deploy-docs.yml'
40 workflow_dispatch:
41
42 permissions:
43 contents: read
44
45 # One docs deploy at a time; don't cancel an in-flight rsync/restart.
46 concurrency:
47 group: deploy-docs
48 cancel-in-progress: false
49
50 jobs:
51 deploy:
52 runs-on: ubuntu-latest
53 steps:
54 - uses: actions/checkout@v6
55
56 - uses: pnpm/action-setup@v4
57 with:
58 version: 10
59
60 - uses: actions/setup-node@v6
61 with:
62 node-version-file: website/.nvmrc
63 cache: pnpm
64 cache-dependency-path: website/pnpm-lock.yaml
65
66 # .smb/config.toml is gitignored (operator-local by design). Recreate the
67 # minimal monorepo config for the `docs` sub-project; deploy fields (kind,
68 # port, remote path, pm2) come from the server App record at deploy time.
69 - name: Write .smb/config.toml
70 run: |
71 mkdir -p .smb
72 cat > .smb/config.toml <<EOF
73 name = "smbCloud Platform"
74
75 [project]
76 id = ${{ vars.SMB_DOCS_PROJECT_ID }}
77 runner = 255
78
79 [[projects]]
80 name = "docs"
81 id = ${{ vars.SMB_DOCS_PROJECT_ID }}
82 frontend_app_id = "${{ secrets.SMB_DOCS_FRONTEND_APP_ID }}"
83 source = "website"
84 EOF
85
86 - name: Deploy docs
87 uses: smbcloudXYZ/smbcloud-deploy-action@v1
88 with:
89 token: ${{ secrets.SMB_TOKEN }}
90 project: docs
91 working-directory: .
92 ssh-private-key: ${{ secrets.SMB_SSH_PRIVATE_KEY }}
93 ssh-key-name: ${{ secrets.SMB_SSH_KEY_NAME }}
94 ssh-known-hosts: ${{ secrets.SMB_SSH_KNOWN_HOSTS }}