Maintaining eight websites should not mean maintaining eight unrelated delivery systems. When every repository invents its own dependency installation, cache keys, runner selection, release checks and scheduled jobs, every useful improvement becomes another manual migration. The resulting drift is expensive, even when individual workflows look reasonable.
I recently standardized delivery pipelines across a mixed portfolio of Astro and Next.js applications. I used one mature pipeline as the reference implementation and adapted its patterns to each repository. The aim was to make improvements portable without making different applications pretend to be identical. The project identities and private operational details are intentionally omitted. For the underlying cost model, see my GitHub Actions and Vercel optimization guide.
1. Standardize the contract, not every command
Start with the responsibilities that every delivery system should account for. A common vocabulary makes a failed workflow easier to diagnose and makes a useful optimization easier to propagate.
| Stage | Shared contract | Application-specific implementation |
|---|---|---|
| Checkout | Retrieve the intended revision | Full history only when required; sparse checkout where proven safe |
| Setup project | Reproducible runtime and dependency installation | npm or pnpm, lockfile and compatible Node version |
| Source validation | Check the change before release | Lint, types, links, content rules, unit tests or security checks |
| Build and validate | Verify the actual release output | Astro static output or a Next.js framework build |
| Browser tests | Exercise important user journeys | Local preview, production read-only smoke tests or a justified remote preview |
| Deploy | Publish an intentional, validated revision | Vercel Git integration or prebuilt artifact upload |
| IndexNow | Notify search engines after publication | Application-specific URL mapping and submission method |
| Maintenance | Detect drift and operational regressions | Centralized public checks and private operational jobs |
The table describes a lifecycle, not a requirement to add eight jobs to every workflow. Some responsibilities already run inside the hosting build. Others need only a small script. Adding duplicate checks solely for naming consistency would defeat the purpose. Preserve existing required status-check names until branch protection and Vercel deployment requirements have been reviewed.
2. Extract project setup into a composite action
The reference repository already used a local composite action. I adopted that pattern across the portfolio so that runtime setup, package caching and installation policy have one implementation per repository instead of being copied into each job.
For example, an npm repository can define .github/actions/setup/action.yml as follows:
name: Setup project
description: Configure Node.js and optionally install locked dependencies.
inputs:
node-version:
description: Application-compatible Node.js version
default: "22"
install:
description: Install dependencies from the lockfile
default: "true"
cache:
description: Enable the npm download cache
default: "true"
runs:
using: composite
steps:
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: ${{ inputs.node-version }}
cache: ${{ inputs.cache == 'true' && 'npm' || '' }}
- name: Install dependencies
if: inputs.install == 'true'
shell: bash
run: npm ciA workflow first checks out the repository, then calls the local action:
- name: Checkout
uses: actions/checkout@v5
- name: Setup project
uses: ./.github/actions/setup
- name: Typecheck
run: npm exec -- tsc --noEmitFor a dependency-free Node script, set both install and cache to "false". For a pnpm project, install the declared pnpm version before configuring the Node cache, then run pnpm install --frozen-lockfile. In a monorepo, explicitly configure the relevant lockfile paths if the defaults do not match the layout. The package cache is not an installed dependency tree; the locked installation is still necessary when dependencies are required.
These examples use readable action version tags. For production, review compatible releases and pin full commit SHAs. See creating a composite action and dependency caching.
3. Design cache keys around compatibility
There are three different things worth caching: package downloads, expensive framework-generated assets, and browser binaries. They have different invalidation rules. A framework asset cache can be reused only when the framework itself can safely invalidate changed inputs. The deployable release artifact, in contrast, must correspond to the intended revision.
The reference Astro build uses a commit-specific cache key with a fallback scoped to the dependency lockfile. I added explicit runner-image and architecture boundaries. For example:
- name: Cache Astro assets
uses: actions/cache@v5
with:
path: node_modules/.astro
key: astro-26.04-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ github.sha }}
restore-keys: |
astro-26.04-${{ runner.arch }}-${{ hashFiles('pnpm-lock.yaml') }}-The location of a framework cache is project-specific; inspect the actual build output before adopting this path. Bound cache growth, track restoration time and hit rates, and remove caching when restoring costs more than recomputing. Keep a clean-build validation path so a warm cache does not hide a broken cold build.
For Playwright, include the browser version or lockfile, runner image, CPU architecture and selected browser family in the key. A Chromium-only cache must not be mistaken for a complete Chromium, Firefox and WebKit installation. The operating-system dependencies still need to be available even when browser binaries are restored.
4. Treat runner upgrades as compatibility migrations
Newer runner images are attractive, but the newest operating system is not automatically the best choice for every workload. In the investigation, a browser installation failed after the moving Ubuntu label switched to a newer image. The application was not the cause of the failure.
The reference pipeline now selects Ubuntu 26.04 explicitly for compatible non-browser work and keeps Ubuntu 24.04 for the browser jobs that depend on it. Other repositories retain their known runtime combinations until their own tests establish compatibility. Consult the GitHub hosted runner reference and the installed Playwright release requirements before choosing an image.
Use the Node version required by the application rather than upgrading every project simultaneously. A runner image upgrade, a Node runtime upgrade and a framework upgrade are separate changes. Keeping them distinguishable reduces the cost of investigating failures.
5. Build once, but recognize genuinely different build inputs
The reference static-site pipeline compiles the website, validates the output, and passes an artifact to the browser test and deployment jobs. The deployment job does not need to check out the entire media directory or repeat the framework build. The packaging step produces the Vercel deployment output from the already built site.
This works for a static site with a compatible deployment adapter. A server-rendered Next.js application may instead keep Vercel as the owner of its full framework build, with GitHub Actions providing fast source validation. A build for testing future publication dates is also not interchangeable with the current production build. Its clock and output directory are deliberate test inputs.
The principle is to avoid identical work, not to eliminate distinct verification. Never disable a production build or replace a framework adapter with a static file upload just to make the workflows look alike.
6. Cancel obsolete work, not essential operations
For push and pull-request CI, use a concurrency policy that discards superseded PR runs without automatically terminating an in-flight production release:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}GitHub concurrency groups are not durable FIFO queues: at most one running and one pending execution can occupy a group, and a new pending run can replace an earlier pending one. For a release that must publish every revision, use an explicit release-queue design instead. Give daily maintenance a separate concurrency group; otherwise a new source change could interfere with the scheduled audit.
Keep job timeouts explicit. Retain short-lived build artifacts only as long as needed for their downstream consumers, and keep failure traces long enough for diagnosis. Avoid uploading large successful test reports if nobody uses them. Never prune recovery archives using ordinary CI artifact retention rules.
7. Centralize public maintenance with reusable workflows
The public controller orchestrates social-card validation, design and accessibility scans, live SEO audits and Lighthouse checks. These inspect public URLs and do not require a private source checkout by default. Eligible standard hosted runners in public repositories avoid drawing from the private Actions allowance.
name: Daily website maintenance
on:
schedule:
- cron: "41 6 * * *"
permissions:
contents: read
concurrency:
group: daily-website-maintenance
cancel-in-progress: false
jobs:
social:
uses: ./.github/workflows/og-check.yml
live:
uses: ./.github/workflows/public-live-check.yml
performance:
uses: ./.github/workflows/lighthouse.ymlThe called workflows must declare on: workflow_call. This example is a public-only design; an existing privileged operation may need narrowly scoped additional permissions. Do not pass all secrets to a shared public workflow. Do not execute untrusted pull-request code with credentials that can access private repositories. Private checks, timed publication and recovery operations stay in their authorized environments.
There is a useful difference between an action and a reusable workflow: a composite action shares steps inside a job, whereas a reusable workflow shares a job graph. Use the former for setup and the latter for maintenance orchestration. A copied local action avoids a new cross-repository dependency, but still requires a versioned rollout to keep the copies aligned. A pinned shared implementation can be a later step once the trust model and compatibility contract are established.
8. Optimize the controller itself
Centralizing a script does not make it efficient. During the follow-up review I found that the live audit fetched the entire sitemap tree twice: once to sample URLs and again to count foreign-host entries. Both computations can use the same snapshot.
const sitemap = await sitemapUrls();
const localUrls = sitemap.filter((url) => {
try {
return new URL(url).host === expectedHost;
} catch {
return false;
}
});
const foreignCount = sitemap.length - localUrls.length;This changes two sitemap traversals to one: a theoretical 50% reduction in those requests when both traversals visit the same set of sitemap documents. It is not a 50% reduction in total audit traffic or cost. Reusing the snapshot also prevents inconsistencies if a deployment changes the sitemap between requests.
The same review identified an unbounded browser-like fetch in the CSP inspection. Adding a 25-second abort signal to the request and consuming the response inside its guarded block makes that part of the audit predictable. A timeout must remain visible in the report; a missing measurement is not proof that the policy is correct.
Finally, I compared the actual site inventory in each audit with the intended portfolio. One store was already in the social-card, design and performance inventories but missing from general live SEO checks. Its own site configuration was added to the proposed public audit change, with store-specific identity expectations rather than the consulting sites’ identity rules.
9. Roll out the standard with evidence
The initial standardization changes were integrated across all eight repositories. That does not mean all eight pipelines were validated. Public-repository checks supplied successful test evidence, while private jobs were rejected before executing their steps. Production deployments can also succeed independently of those missing checks.
The next gates are successful private CI after capacity becomes available, a complete scheduled controller run, and verified equivalent coverage before removing redundant local monitoring. The sitemap optimization and expanded live-audit coverage were proposed in a separate pull request; their operational impact still needs validation.
Track these as separate milestones: code merged, CI executed and passed, production revision verified, daily maintenance executed, and measured savings. A useful standard makes those states easy to distinguish. It does not turn a merge into a test result or a projected saving into a billing fact.
The end goal is not eight identical YAML files. It is a delivery system in which a proven improvement can be applied consistently, exceptions are documented, and each release consumes only the work necessary to establish confidence.
