SR-007 — Site Build & Deployment Pipeline: System Requirements
By Engineering Team•October 12, 2026•4 min read
| Metadata | Details |
|---|---|
| System Name | astro-static-site Site Build & Deployment Pipeline Specifications |
| Document ID | SR-STATIC-007 |
| Author | Engineering Team |
| Status | Draft / Implementation |
Covers only the application workflow: building the Astro site and deploying it to Cloudflare Pages. Creating the Pages project, R2 bucket, DNS and edge rules is a separate workflow, specified in SR-006 — Infrastructure Provisioning Pipeline. It traces to BRD-001 and BRD-004. Delivery-pipeline needs are in BRD-006. Cite requirement IDs with the document ID (e.g. SR-007 SR-F-03).
1. Scope
Workflow file: .github/workflows/app.yml. When its jobs run, how a build is promoted, the guards and the order with infrastructure are specified in SR-005 — Release Promotion Pipeline; this document covers what the jobs do. The Pages project must already exist; this workflow never creates or changes infrastructure.
2. Functional System Requirements
| ID | Description | Traceability |
|---|---|---|
| SR-F-01 (Triggers) | Defined in SR-005: only a person starts app.yml, on main, with a commit and a target. |
BR-1.1 (BRD-001) |
| SR-F-02 (Scan Gate) | Every run scans the commit with Trivy per SR-004 SR-F-01..03 before it builds. | BR-1.1 (BRD-004) |
| SR-F-03 (Build) | Each run builds for its target only: it installs dependencies with npm ci on a pinned Node version and runs npm run build with that environment’s media address and Analytics ID, producing static output in dist/ (SR-001 SR-F-01). It fails if dist/images exists. |
BR-1.1 (BRD-001) |
| SR-F-04 (Deploy) | The run deploys the dist/ it built to the target’s Pages project as its main deployment, with Wrangler, after the images the build links are in the target’s media bucket (SR-005 SR-F-10); a prod run deploys only after its build matched the stored nonprod build (SR-005 SR-F-03). |
BR-1.1 (BRD-001) |
| SR-F-05 (Pull Request Behaviour) | Pull requests start no workflow and get no preview; the site is checked when it is released to non-production. | BR-1.1 (BRD-004) |
| SR-F-06 (Prerequisite) | The Pages project exists, created by the infrastructure workflow (SR-006 SR-F-04). If it does not, deployment fails and is not retried automatically. | BR-1.1 (BRD-INFRA-001) |
| SR-F-07 (Headers Shipped) | The _headers file in public/, with the Content-Security-Policy written by scripts/write-headers.mjs during the build, is part of dist/, so the response headers and caching in SR-009 SR-F-02 and SR-F-03 are deployed with the site. |
BR-1.2 (BRD-001) |
| SR-F-08 (Values) | Where this workflow’s values come from is defined in SR-008. It uses the Pages publishing token and the media copy key pair; infrastructure and state credentials are never available to it. | BR-1.3 (BRD-INFRA-001) |
3. Non-Functional & Security Requirements
| ID | Specification | Traceability |
|---|---|---|
| SR-NF-01 (Fail Closed) | A failed scan or failed build stops the workflow; nothing deploys. | BR-1.1 (BRD-004) |
| SR-NF-02 (Pinned Actions and Tools) | Every action and tool version, including Node, is pinned; no @master or latest. |
SR-004 SR-NF-04 |
| SR-NF-03 (Serialised Releases) | Each run holds the workflow-level concurrency group app-<environment> with cancel-in-progress: false, so two releases to one environment never overlap, a re-run of a failed job included. |
BR-1.1 (BRD-001) |
| SR-NF-06 (Re-run What Failed) | The run is split into the jobs build, media and deploy, which pass the build on as an artifact of the run, verified by its SHA-256 before use. A failed job is re-run on its own; uploads overwrite the artifact of an earlier attempt. |
BR-1.1 (BRD-001) |
| SR-NF-04 (Ephemeral Runners) | All jobs run on ephemeral ubuntu-latest runners. |
SR-INFRA-001 SR-NF-03 |
| SR-NF-05 (Build Reproducibility) | The build is deterministic from the lockfile and the Astro content cache; SR-005 SR-F-03 proves a prod build differs from the stored nonprod build of the same commit only in environment values. | BR-1.1 (BRD-001) |