Concrete
Concepts

Publishing and environments

Publishing, or publishing to a customer — what a publisher key decides, what the platform checks, and how a version is rolled back.

What it is

concrete publish sends your built template to HomePages. It takes no environment flag, because the environment is in the key:

concrete publish

The key is CONCRETE_TOKEN, read from the process environment or from the workspace's gitignored .env. A HomePages admin issues it. Its prefix (cpt_prod_…, cpt_staging_…, cpt_dev_…) names the environment, and the command publishes where the key points.

Why it works this way

A flag that selects an environment is a flag that can be forgotten, and the failure is publishing to the wrong one. Folding the target into the credential removes the choice: there is no default to get wrong, and a key for one environment is refused by another by name, before it is even looked up.

Environments are independent for the same reason. There is no promote verb and no cross-environment state — whether a template ever sat on staging is not something production holds or asks about. Publishing to a second environment is the same command with that environment's key, and because the build is deterministic, the same tree yields the same artifact hash on both.

Who a template is offered to stays where a developer can see it: scope, in template.ts, in the same diff as the code. The platform's only say is what a key is permitted to declare. That way an audience is never hand-edited in a database behind a developer's back — they change scope and publish, and the platform either accepts the declaration or names the org ids the key does not cover.

And a version is content-addressed rather than numbered. Numbering would make "publish the same thing twice" a decision somebody has to make; hashing makes it a no-op, and makes rolling back the same operation as going forward.

How it works

The command builds and checks on every run. It runs concrete build, grades the result with concrete check, and only then assembles the artifact: the built files, your fixtures, the hosted playground and, for an image or document template, its captures. An artifact is never reused. A red check stops everything: nothing is assembled, and nothing is published.

The publication is a record you can watch. The command creates a publication, uploads the artifact straight to storage through a presigned URL, submits it, and polls until it settles, printing one stderr line per stage:

target   production · key cpt_prod_…a41c · https://api.homepages.io
build    built 4f2c1a09b3de · 7 sections · check passed
upload   riverside 4f2c1a09b3de · 2.4 MB · publisher "Studio North"
verify   ok
write    template build 4f2c1a09b3de replaces the previous one · sections: 2 new, 1 changed, 4 unchanged
adopt    3 deliverables adopting this build · 11 deliverables checked
review   https://play.homepages.io/riverside/…/

Under --json the settled record is the only thing on stdout, and every one of those lines still goes to stderr. --dry-run uploads and verifies, reports what publishing would change, and writes nothing.

What the platform verifies. Before any write: that the manifest parses and its schema is one the platform knows; that every content hash recomputes over the bytes it actually received; that the framework version is at or above the floor; that scope is inside what the key permits; the contract assertions over every section's schema and fill spec; and a load-and-render smoke — every renderer and logic bundle is imported and each section rendered once, so a bundle that throws on import can never become the current version.

What it trusts is that concrete check ran. concrete publish checks on every run and refuses on red, so an unchecked build reaches the platform only by assembling an artifact by hand.

Versions, hashes and rollback. An environment holds one build of each template, named by the artifact hash, and a publication replaces it: the write line says whether the template is new or its build replaces the previous one, and counts its sections new, changed and unchanged. Publishing a tree the environment already holds as current changes nothing, says so (already current) and exits 0. Rolling back is publishing the older tree, an ordinary publish that replaces the build. There is no rollback verb, because there does not need to be one.

Adoption follows every write. The platform scans the template's live deliverables and republishes the ones that were in sync, so a fix reaches existing sites rather than only the next one. The adopt line reports what it enqueued out of what it scanned.

The review link. A published version gets a hosted playground URL — the same playground concrete dev gives you, served over the fixtures your artifact carries, on a link you can hand to somebody who has no workspace and no account.

Scope and audience. scope: "global" offers the template to every organization and requires a key permitted to publish globally. Naming organizations instead restricts it to them:

import { defineTemplate, website } from "@homepages/concrete";
import icon from "./icon.svg";

export default defineTemplate({
  key: "riverside",
  name: "Riverside",
  format: website,
  icon,
  scope: { org: "3f7c1e40-9a2b-4c51-8d06-1b5e9a77c2f4" },
  pages: { home: { label: "Home", path: "/", page: () => null } },
});

A customer reads their organization id from Settings → Organization → General. Every id you name must be one the key permits, or the publication is refused before anything is uploaded. The org set is the audience and never the identity: a key is one template however many organizations hold it, so widening the audience updates that template rather than minting a second one.

What it is not

Publishing is not a deployment you can stage and promote. Each environment is reached by its own key, and nothing carries between them.

The key is not a user account. It belongs to no person and no organization inside the platform; it names a publisher, carries an audience, and is revoked by timestamp rather than deleted, so the record keeps naming who published what.

And --dry-run is not a weaker publish. It goes through upload and verification — the same checks, the same refusals — and stops before the write.

Where next

Publish to a customer's organization has that end to end, and template.ts states the key and the scope a publish reads off your template. The full flag surface and exit codes are concrete publish; the build it runs in front of is concrete build, and the grading after it is concrete check.

On this page