|
1 | 1 | name: Docs Deploy |
2 | 2 |
|
3 | | -# The ONE path by which this repository's two docs sites reach production, |
4 | | -# one job each: |
| 3 | +# The ONE path by which this repository's docs site reaches production: the |
| 4 | +# `deploy` job, Vercel project `objectstack`, Root Directory `apps/docs`. |
5 | 5 | # |
6 | | -# - `deploy`: the ObjectStack docs, Vercel project `objectstack`, Root |
7 | | -# Directory `apps/docs`; |
8 | | -# - `deploy-ui-site`: the Object UI docs at www.objectui.org, Vercel project |
9 | | -# `objectui`, Root Directory `ui/apps/site`. That site came here with the |
10 | | -# objectui tree; objectui's own copy of this workflow was deleted with the |
11 | | -# rest of `ui/.github/workflows/`, and nothing else deploys it. Its header |
12 | | -# below says what differs from `deploy`. |
13 | | -# |
14 | | -# Everything this header says applies to both jobs. The two are independent: |
15 | | -# one going red does not stop or cancel the other. |
| 6 | +# The Object UI docs site (www.objectui.org) was retired when its pages folded |
| 7 | +# into this one. Its old URLs answer host-scoped permanent |
| 8 | +# redirects from `apps/docs/redirects.mjs` (`objectuiRedirects`) once the |
| 9 | +# objectui.org domains point at this project; nothing deploys it any more. |
16 | 10 | # |
17 | 11 | # ## Why the build runs here and not on Vercel |
18 | 12 | # |
@@ -217,139 +211,3 @@ jobs: |
217 | 211 | echo |
218 | 212 | echo "Deployment: ${{ steps.deploy.outputs.url || 'none (the run stopped before the deploy step finished)' }}" |
219 | 213 | } >> "$GITHUB_STEP_SUMMARY" |
220 | | -
|
221 | | - # ── The Object UI docs site (www.objectui.org) ───────────────────────────── |
222 | | - # |
223 | | - # The same build-here, upload-prebuilt path as `deploy` above, for the Vercel |
224 | | - # project `objectui`. `ui/apps/site/vercel.json` turns that project's Git |
225 | | - # deployments off (`git.deploymentEnabled: false`), so this job is the only |
226 | | - # thing that publishes the site, and every failure is red, as above. |
227 | | - # |
228 | | - # What differs from `deploy`, and why: |
229 | | - # |
230 | | - # - The project's Root Directory must read `ui/apps/site`. It read |
231 | | - # `apps/site` while the site lived in the objectui repository, and it is |
232 | | - # a dashboard setting that no file here can change. A step right after |
233 | | - # `vercel pull` reads the setting the pull wrote and goes red, naming the |
234 | | - # setting and its value, when it is anything else; without that step |
235 | | - # the old value fails later inside `vercel build`, as an error that does |
236 | | - # not say a dashboard setting is the cause. |
237 | | - # - `vercel build` gets no token. It runs `vercel.json`'s install and build |
238 | | - # commands, which run every workspace package's lifecycle scripts, and |
239 | | - # it does not call the Vercel API. Only the `pull` and `deploy` steps, |
240 | | - # which do, see VERCEL_TOKEN. objectui's own workflow made this choice |
241 | | - # for the same reason. |
242 | | - # - objectui's pinned-@objectstack restore and build steps are not ported. |
243 | | - # In this repository every @objectstack package the site imports is a |
244 | | - # workspace package, and `vercel.json`'s build command builds it from |
245 | | - # this tree through turbo's `^build`. |
246 | | - # |
247 | | - # The site's own install and build commands live in `ui/apps/site/vercel.json` |
248 | | - # and are unchanged from objectui: `pnpm i` installs this whole workspace from |
249 | | - # any member directory, and its build command's `cd ../..` lands in `ui/`, |
250 | | - # from which turbo resolves this repository's root and builds |
251 | | - # `@object-ui/site` with its full closure (65 tasks, all built, on the |
252 | | - # local run measured below). |
253 | | - deploy-ui-site: |
254 | | - name: Deploy objectui docs to Vercel (production) |
255 | | - runs-on: ubuntu-latest |
256 | | - # The build behind `vercel.json`'s command (the site, its @object-ui |
257 | | - # packages and their @objectstack closure: 65 turbo tasks, none cached) |
258 | | - # measured 596 s at `--concurrency=2` on a shared dev container; the runner |
259 | | - # adds install and upload. |
260 | | - timeout-minutes: 30 |
261 | | - env: |
262 | | - # Identifiers, not credentials, as in `deploy`: the same team, and the |
263 | | - # project that serves www.objectui.org. |
264 | | - VERCEL_ORG_ID: team_06nvlGKZCkwhzdXmRdxeCNnB |
265 | | - VERCEL_PROJECT_ID: prj_v1rXIczaI7YGmXmseQCLFUFOFxTB |
266 | | - # The same pin as `deploy`'s VERCEL_CLI_VERSION; move the two together. |
267 | | - VERCEL_CLI_VERSION: '60.1.3' |
268 | | - # The value the project's Root Directory must have; see the header. |
269 | | - VERCEL_ROOT_DIRECTORY: ui/apps/site |
270 | | - steps: |
271 | | - - name: Refuse any ref but main |
272 | | - if: github.ref != 'refs/heads/main' |
273 | | - run: | |
274 | | - echo "::error::Docs Deploy publishes to PRODUCTION and runs only from main; this run is on ${GITHUB_REF}. Re-run it with 'main' selected in the branch picker." |
275 | | - exit 1 |
276 | | -
|
277 | | - - name: Require the Vercel token |
278 | | - env: |
279 | | - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
280 | | - run: | |
281 | | - if [ -z "${VERCEL_TOKEN:-}" ]; then |
282 | | - echo "::error::The secret VERCEL_TOKEN is not visible to this run, so www.objectui.org cannot be deployed and production is NOT being updated. It is provided as an objectstack-ai ORGANIZATION secret: check that it still exists and that this repository is in its repository access list (org Settings -> Secrets and variables -> Actions). Then re-run this workflow." |
283 | | - exit 1 |
284 | | - fi |
285 | | - echo "VERCEL_TOKEN is set." |
286 | | -
|
287 | | - - name: Checkout repository |
288 | | - uses: actions/checkout@v7 |
289 | | - |
290 | | - - name: Setup workspace |
291 | | - uses: ./.github/actions/setup-workspace |
292 | | - |
293 | | - # From the repository root, for the reason `deploy`'s comment on this |
294 | | - # step gives: the CLI applies the Root Directory relative to its cwd. |
295 | | - - name: Pull the production project settings |
296 | | - env: |
297 | | - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
298 | | - run: npx --yes "vercel@${VERCEL_CLI_VERSION}" pull --yes --environment=production --token="$VERCEL_TOKEN" |
299 | | - |
300 | | - - name: Require the project's Root Directory to be ui/apps/site |
301 | | - run: | |
302 | | - set -euo pipefail |
303 | | - actual="$(node -e " |
304 | | - const fs = require('node:fs'); |
305 | | - const file = '.vercel/project.json'; |
306 | | - if (!fs.existsSync(file)) { console.log('(vercel pull wrote no ' + file + ')'); process.exit(0); } |
307 | | - const settings = JSON.parse(fs.readFileSync(file, 'utf8')).settings || {}; |
308 | | - console.log(settings.rootDirectory ?? '(not set)'); |
309 | | - ")" |
310 | | - if [ "$actual" != "$VERCEL_ROOT_DIRECTORY" ]; then |
311 | | - echo "::error::The Vercel project ${VERCEL_PROJECT_ID} has Root Directory '${actual}', and this repository builds the site from '${VERCEL_ROOT_DIRECTORY}'. Nothing is deployed. A maintainer sets it in the Vercel dashboard: project objectui -> Settings -> Build and Deployment -> Root Directory = ${VERCEL_ROOT_DIRECTORY}. Then re-run this workflow." |
312 | | - exit 1 |
313 | | - fi |
314 | | - echo "Root Directory: ${actual}" |
315 | | -
|
316 | | - # No VERCEL_TOKEN here; see the header. TURBO_FORCE for the reason |
317 | | - # `deploy`'s build step gives. |
318 | | - - name: Build the site (vercel build --prod) |
319 | | - env: |
320 | | - TURBO_FORCE: 'true' |
321 | | - run: npx --yes "vercel@${VERCEL_CLI_VERSION}" build --prod |
322 | | - |
323 | | - - name: Assert the build produced a deployable output |
324 | | - run: | |
325 | | - set -euo pipefail |
326 | | - if [ ! -f ui/apps/site/.next/BUILD_ID ]; then |
327 | | - echo "::error file=ui/apps/site/vercel.json::vercel build exited 0 but produced no ui/apps/site/.next/BUILD_ID - the site was not built, so nothing is deployed." |
328 | | - exit 1 |
329 | | - fi |
330 | | - if [ ! -f .vercel/output/config.json ]; then |
331 | | - echo "::error::vercel build exited 0 but wrote no .vercel/output/config.json at the repository root - there is no prebuilt output to deploy." |
332 | | - exit 1 |
333 | | - fi |
334 | | - echo "Built the objectui site: BUILD_ID=$(cat ui/apps/site/.next/BUILD_ID)" |
335 | | -
|
336 | | - - name: Deploy the prebuilt output to production |
337 | | - id: deploy |
338 | | - env: |
339 | | - VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} |
340 | | - run: | |
341 | | - set -euo pipefail |
342 | | - url=$(npx --yes "vercel@${VERCEL_CLI_VERSION}" deploy --prebuilt --prod --token="$VERCEL_TOKEN") |
343 | | - echo "url=${url}" >> "$GITHUB_OUTPUT" |
344 | | - echo "Deployed: ${url}" |
345 | | -
|
346 | | - - name: Publish the run to the summary |
347 | | - if: always() |
348 | | - run: | |
349 | | - { |
350 | | - echo "### Docs Deploy (www.objectui.org) — ${{ job.status }}" |
351 | | - echo |
352 | | - echo "Commit: \`${{ github.sha }}\` (${{ github.event_name }})" |
353 | | - echo |
354 | | - echo "Deployment: ${{ steps.deploy.outputs.url || 'none (the run stopped before the deploy step finished)' }}" |
355 | | - } >> "$GITHUB_STEP_SUMMARY" |
0 commit comments