Plan CI checks and immutable releases
Build once, promote the tested bytes
Continuous integration (CI) checks changes with repeatable tooling. Continuous delivery keeps an approved artifact ready to deploy; continuous deployment automates eligible promotion. A pipeline should review source, lockfile, dependency provenance, lint, semantic type checks, unit and component tests, production build, security policy and browser smoke tests. Configure tests against the actual artifact, not only a dev server. Separate trusted release jobs from untrusted pull request code; do not expose production credentials to unreviewed workflows. Use reviewed pinned action revisions, restricted permissions and environment approvals when supported. GitHub Actions artifacts can move outputs between jobs; dependency caches are not release artifacts.
Define explicit promotion gates
This local exercise consumes trusted synthetic metadata. A missing or skipped check blocks promotion. Approval and digest equality are separate conditions. Actual evidence should bind every check to the same commit, artifact and approved environment; do not trust a JSON file supplied by arbitrary application code. A digest detects differing bytes only when the expected digest is obtained through a trusted channel. Provenance and authorization are additional requirements.
export const requiredChecks = ['lint','typecheck','unit','component','build','security','browser'];// Trusted pipeline metadata; real CI must authenticate the evidence.export function promotionIssues(release, expectedDigest) { const issues = requiredChecks.filter(k => release.checks[k] !== 'pass').map(k => 'Check: '+k); if (!/^[a-f0-9]{64}$/.test(expectedDigest) || release.digest !== expectedDigest) issues.push('Digest mismatch'); if (release.approved !== true) issues.push('Approval missing'); return issues;}import {createHash} from 'node:crypto';// Hash the exact bytes that will be promoted, not the source commit name.export function artifactDigest(bytes) { return createHash('sha256').update(bytes).digest('hex');}import {promotionIssues,requiredChecks} from './gate.mjs';import {artifactDigest} from './digest.mjs';const artifact = Buffer.from('synthetic release archive v2');const digest = artifactDigest(artifact);const release = {digest,approved:true,checks:Object.fromEntries(requiredChecks.map(k=>[k,'pass']))};console.log(promotionIssues(release,digest)); // [] (synthetic evidence only)console.log(promotionIssues(release,artifactDigest(Buffer.from('different')))); // ['Digest mismatch']The first result is empty because the sample deliberately marks every check as passed. The second reports a mismatch. Neither means any CI service ran. In a real pipeline freeze dependencies with a reviewed lockfile, run the checks, retain the archive with its digest and release metadata, deploy that exact artifact to staging, then promote the same bytes after approval. Runtime configuration may vary if explicitly compatible; build-time public configuration must be treated as part of the artifact. Do not rebuild on promotion or overwrite content-hashed files. Record rollback target, retention period and verification steps. Use short-lived narrowly scoped deployment identity, not long-lived secrets in frontend variables.
Practice a release review
A release has green unit tests but skipped browser tests. The build checksum also differs from the approved artifact. Predict the result and explain why rerunning only a unit test cannot resolve the two failures. The offline pipeline template in this chapter is a planning worksheet, not an enabled workflow.