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 development (the deploy branch) that touch the docs, plus
26 # manual runs. Adjust the branch to your release flow; workflow_dispatch lets you
27 # run it from any branch.
28 #
29 # NOTE: the action installs the latest published CLI release and runs it with
30 # `--ci`. That flag must exist in the installed release, so this requires a
31 # published smbcloud-cli release that includes `--ci` (pin a specific version
32 # below if `latest` ever regresses).
33
34 on:
35 push:
36 branches: [development]
37 paths:
38 - 'website/**'
39 - 'docs/**'
40 - '.github/workflows/deploy-docs.yml'
41 workflow_dispatch:
42
43 permissions:
44 contents: read
45
46 # One docs deploy at a time; don't cancel an in-flight rsync/restart.
47 concurrency:
48 group: deploy-docs
49 cancel-in-progress: false
50
51 jobs:
52 deploy:
53 runs-on: ubuntu-latest
54 steps:
55 - uses: actions/checkout@v6
56
57 - uses: pnpm/action-setup@v4
58 with:
59 version: 10
60
61 - uses: actions/setup-node@v6
62 with:
63 node-version-file: website/.nvmrc
64 cache: pnpm
65 cache-dependency-path: website/pnpm-lock.yaml
66
67 # .smb/config.toml is gitignored (operator-local by design). Recreate the
68 # minimal monorepo config for the `docs` sub-project; deploy fields (kind,
69 # port, remote path, pm2) come from the server App record at deploy time.
70 - name: Write .smb/config.toml
71 run: |
72 mkdir -p .smb
73 cat > .smb/config.toml <<EOF
74 name = "smbCloud"
75
76 [project]
77 id = ${{ vars.SMB_DOCS_PROJECT_ID }}
78 runner = 255
79
80 [[projects]]
81 name = "docs"
82 id = ${{ vars.SMB_DOCS_PROJECT_ID }}
83 frontend_app_id = "${{ secrets.SMB_DOCS_FRONTEND_APP_ID }}"
84 source = "website"
85 EOF
86
87 - name: Deploy docs
88 uses: smbcloudXYZ/smbcloud-deploy-action@v1
89 with:
90 token: ${{ secrets.SMB_TOKEN }}
91 project: docs
92 working-directory: .
93 ssh-private-key: ${{ secrets.SMB_SSH_PRIVATE_KEY }}
94 ssh-key-name: ${{ secrets.SMB_SSH_KEY_NAME }}
95 ssh-known-hosts: ${{ secrets.SMB_SSH_KNOWN_HOSTS }}