What is CI/CD for AI-built code?
CI/CD (Continuous Integration / Continuous Deployment) automates the pipeline from code commit to production. For AI-built code, the pipeline needs additional gates: an eval pass to confirm correctness, a security scan to catch leaked secrets and vulnerabilities, and a git history check to ensure traceability. Without these gates, you are shipping code at high velocity with no verification that it actually works, is safe, or can be rolled back. This class teaches you how to build that pipeline.
Module 01
Pipeline Anatomy: Source to Production
Here is the problem. AI-generated code carries 2.7x higher vulnerability density than human-written code, and 81% of enterprise technology leaders reported production failures linked to AI-generated code by mid-2026. You are shipping code you did not write line by line. The pipeline is how you verify it.
The six stages, in order:
- Source — you commit to a feature branch. The commit triggers the pipeline.
- Build — the project compiles or bundles. If it fails to build, everything stops.
- Test — unit tests, integration tests, linting. Fast, deterministic, cheap.
- Eval gate — LLM evaluation against your golden dataset. This is where Evals (Class #71) plugs in. If the eval score drops below your threshold, the merge is blocked.
- Security scan — static analysis, secret detection, dependency audit. This is where Security (Class #72) plugs in. In 2025, 28.65 million new hardcoded secrets were added to public GitHub commits — a 34% year-over-year increase (GitGuardian State of Secrets Sprawl 2025).
- Deploy — the code ships to production. Only after every prior gate passes.
Why this order matters
Cheap gates run first. A failing build is caught in seconds and costs nothing. An eval gate costs LLM API calls. A security scan costs compute time. Put the fast, free checks first so you fail early and cheaply.
The DORA metrics (DevOps Research and Assessment) define four indicators that separate high-performing teams from the rest: deployment frequency, lead time for changes, change failure rate (elite teams hold this below 15%), and failed deployment recovery time (elite teams recover in under one hour). A fifth metric, deployment rework rate, was added in 2025 to capture the hidden cost of fixing post-deployment bugs. For AI-built code, rework rate is the one to watch: AI can inflate throughput metrics while silently increasing the volume of code that needs to be patched after it ships.
Module 02
The DDS Deploy Discipline
I will teach the general pipeline in Modules 03 through 08. But I lead with how I actually do it, because the specifics are more useful than the theory.
The workflow
- Build on staging. Every new section or template is first deployed to a staging Shopify theme (a separate theme ID, not the live MAIN). The live store is never touched during development.
- Render-verify, cache-busted. Open the staging theme preview with
?preview_theme_id=STAGING_ID&cache=falseappended. Check three viewports: 1440x900 (desktop), 1440x680 (laptop), 390x844 (mobile). If anything renders wrong, fix it on staging. Never promote a broken render. - Promote with length parity. The deploy script GETs each file from staging, PUTs it to MAIN, then re-GETs from MAIN and asserts the byte length matches staging. If lengths diverge, the script halts and reports the mismatch. This catches silent truncation, encoding issues, and partial writes.
- Pre-change snapshot. Before the deploy script writes anything to MAIN, it saves a copy of every file it is about to overwrite. If the deployment causes problems,
rollback.ps1restores from the snapshot in a single command.
DDS Trap: the hardcoded array
The deploy script (deploy.ps1) uses a hardcoded $sectionFiles array. A new section silently fails to deploy unless its filename is added to that array. This has cost time. The preflight script (preflight.ps1) now checks for orphaned files that exist in the sections directory but are not listed in the deploy array.
This discipline is not GitHub Actions. It is a PowerShell script calling the Shopify Admin REST API. But the principle is identical: source → staging → verify → promote → snapshot rollback. The staging theme is the preview environment. The length-parity assertion is the deployment gate. The snapshot is the rollback. Every deployment pipeline, regardless of stack, needs these four components.
Module 03
A Real GitHub Actions Workflow
.github/workflows/ that defines triggers, jobs, and steps. The workflow below builds, tests, runs evals, scans for secrets, and deploys only if every gate passes.
This is a complete, valid GitHub Actions workflow for an AI-built project. It covers all six pipeline stages from Module 01.
name: CI/CD Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
id-token: write # Required for OIDC
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm test
eval-gate:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npx promptfoo eval --config evals/config.yml
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- run: |
SCORE=$(cat evals/output.json | jq '.results.score')
if (( $(echo "$SCORE < 0.85" | bc -l) )); then
echo "Eval score $SCORE below threshold 0.85"
exit 1
fi
security-scan:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npx semgrep scan --config auto --error
deploy:
needs: [eval-gate, security-scan]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci && npm run build
- run: npm run deploy
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
What each job does
- build-and-test — installs dependencies, builds the project, and runs unit tests. If any step fails, the entire pipeline stops.
- eval-gate — runs Promptfoo against your golden dataset. If the aggregate eval score falls below 0.85, the job exits with code 1 and the merge is blocked. This is the Evals (Class #71) gate in action.
- security-scan — runs gitleaks to detect hardcoded secrets in the git history, then runs Semgrep for static analysis. This is the Security (Class #72) gate in action.
- deploy — only runs on pushes to
main(not on pull requests) and only after both eval-gate and security-scan pass. Uses a protected environment with its own approval rules.
Note: the needs keyword
The needs keyword defines job dependencies. eval-gate and security-scan both need build-and-test to pass first, but they run in parallel with each other. deploy needs both to pass. This fan-out / fan-in pattern is the standard way to structure a multi-stage pipeline.
Module 04
Branch Protection & PR Gating
Required settings for the main branch
- Require pull requests. No direct pushes to main. Every change goes through a PR so the pipeline runs.
- Require status checks to pass. Select the specific jobs from your workflow:
build-and-test,eval-gate, andsecurity-scan. All must pass before the merge button activates. - Require branches to be up to date. The PR must be tested against the latest code in main. This prevents a passing PR from merging when main has changed underneath it.
- Require conversation resolution. If a reviewer leaves a comment, it must be resolved before merging.
This is where your Git (Class #73) discipline intersects with deployment. A clean commit history, enforced through branch protection and PR gating, means every deployment is traceable to a specific PR, a specific set of changes, and a specific set of passing checks. When something breaks in production, you can trace it back to the exact merge that introduced it.
Common trap: skipped status checks
If a required workflow is skipped due to path filtering or conditional logic, GitHub reports its status as “Success.” This means a skipped eval gate does not block the merge. Make sure your eval and security jobs run unconditionally on pull requests to the main branch.
Module 05
Staging & Preview Environments
For web applications, services like Vercel, Netlify, and Cloudflare Pages create a unique preview URL for every pull request automatically. The reviewer clicks the link, sees the running application, and confirms it works.
For Shopify themes, the pattern is different. You deploy to a staging theme ID and preview it with a URL parameter:
https://your-store.myshopify.com/pages/your-page?preview_theme_id=STAGING_THEME_ID&cache=false
The &cache=false parameter is critical. Without it, you might be verifying a cached version of the page, not the version you just deployed. I have wasted time debugging “broken” pages that were actually fine — I was just looking at the cached old version.
Verification checklist (three viewports)
- 1440 × 900 — desktop monitor. Check layout, typography, and the 3-column grid.
- 1440 × 680 — laptop screen. Check that the hero fits above the fold and the sticky TOC works.
- 390 × 844 — mobile (iPhone 14 / 15 viewport). Check that the layout collapses cleanly, the TOC is accessible, and no horizontal overflow occurs.
Module 06
Staged Rollout: Canary, Blue-Green, Feature Flags
| Strategy | Mechanism | Rollback Speed | Use When |
|---|---|---|---|
| Canary | Route 1–5% of traffic to new version | Seconds (reroute) | You need real-user validation before full commit |
| Blue-Green | Two identical environments; switch traffic | Seconds (switch) | You need zero-downtime and instant rollback |
| Feature Flags | Code ships dormant; activation separate | Milliseconds (toggle) | You want per-feature control and gradual exposure |
The 2026 industry consensus is to layer all three. Use blue-green for infrastructure stability (the “safe environment”). Use canary for traffic-based validation (the “gradual exposure engine”). Use feature flags for business-logic control (the “fine-grained toggle”). An estimated 80% of large organizations are expected to adopt platform engineering by end of 2026, and these platforms typically bake all three strategies into their deployment templates.
Feature flag debt
Feature flags create technical debt. Every flag you add is a conditional branch in your code. Set explicit exit criteria for every flag: once a feature is 100% rolled out and stable for 30 days, retire the flag. If you do not manage flag lifecycle, you end up with a codebase full of dead conditionals that no one is confident enough to remove.
Module 07
Secrets Management
This is where the Security (Class #72) “the AI shipped its own API key” failure mode becomes a deployment concern. If your AI coding agent generates code that contains a hardcoded API key, and your pipeline does not scan for secrets, that key ships to production and potentially to a public repository.
Three levels of secrets management
- Environment variables. The baseline. Store secrets as encrypted environment variables in your CI/CD platform (GitHub Actions secrets, for example). Reference them in your workflow YAML. They are never exposed in logs or code.
- OIDC (OpenID Connect). The current standard. Instead of storing a long-lived cloud access key as a secret, your workflow requests a short-lived token from your cloud provider at runtime. The token expires in minutes. If it leaks, the window of exposure is minimal. GitHub Actions supports OIDC natively for AWS, Azure, and GCP. As of July 2026, GitHub uses immutable OIDC claims for new repositories to prevent claim spoofing.
- Dedicated secrets manager. For production applications with many secrets, use a dedicated secrets manager (HashiCorp Vault, AWS Secrets Manager, Google Secret Manager). These provide audit logging, automatic rotation, and fine-grained access control.
AI-specific risk: MCP config files
AI-service secrets (API keys for LLM infrastructure, vector storage, MCP server configs) surged 81% in 2025. Over 24,000 secrets were leaked from MCP configuration files in their first year. If your AI agent writes an MCP config with a real API key, and you commit that config, the key is exposed. Add MCP config files to your .gitignore and scan for them explicitly in your security gate.
Module 08
Rollback Strategy & Post-Deploy Observability
Rollback patterns
- Container image tags. For containerized deployments, tag every image with the git SHA. Rolling back means redeploying the previous tag. The DDS Shopify equivalent: every file overwritten during a deploy is saved to a snapshot directory before the write.
- Database migrations. Every migration must be reversible. If your deployment includes a schema change that cannot be rolled back, you have created a one-way door. Flag those explicitly in your pre-deploy checklist.
- Traffic switching. If you use blue-green deployment, rollback is a traffic switch. If you use feature flags, rollback is a toggle. Both are sub-second operations.
Post-deploy monitoring
The deployment is not done when the script finishes. It is done when you have confirmed that production is healthy. Define guardrail metrics before you deploy:
- Error rate — if the error rate exceeds your baseline by more than a defined threshold (e.g., 2x), trigger an alert.
- P95 latency — if the 95th percentile response time exceeds your SLA, investigate.
- Business metrics — conversion rate, checkout completion, page load time. A deployment that passes all technical checks but drops conversion by 15% is still a failure.
The DORA rework metric
The deployment rework rate — the ratio of unplanned deployments needed to fix bugs introduced by a previous deployment — is the metric that catches AI-inflated throughput. If your deployment frequency is high but your rework rate is also high, you are generating churn, not value. Track both.
Module 09
The Four Pillars: Correct, Safe, Traceable, Shippable
Evals & Testing AI Output
Golden datasets, LLM-as-judge, Promptfoo, DeepEval, RAGAS. The eval gate in your pipeline.
Security for AI-Generated Code
Secret detection, SAST, dependency audit, SBOM. The security scan gate in your pipeline.
Git & AI Workflows
Branching strategy, commit hygiene, PR gating. The version control that makes every deployment auditable.
Deployment & CI/CD (this class)
The pipeline that consumes all three. If evals pass, security passes, and git history is clean, the code ships.
The deployment pipeline is the final consumer. It does not produce correctness, safety, or traceability. It requires them. If any pillar is missing, the pipeline either rejects the code or ships it with unverified risk. Build all four.
Module 10
Pre-Deploy Checklist & Paste-Ready Prompts
Pre-deploy checklist
- All CI status checks pass (build, lint, test, eval gate, security scan).
- No hardcoded secrets in the codebase (gitleaks reports zero findings).
- Staging environment renders correctly at 1440x900, 1440x680, and 390x844.
- Deploy script produces matching file lengths between staging and production.
- A rollback snapshot exists and the rollback script has been tested.
- Post-deploy monitoring dashboards are open and alert thresholds are configured.
- Database migrations (if any) are reversible.
- Feature flags for new features are set to “off” by default.
Paste-ready prompts
Write a GitHub Actions workflow for this project. It should: 1. Trigger on push to main and pull_request to main. 2. Run build, lint, and unit tests in the first job. 3. Run an eval gate (promptfoo eval) that blocks the merge if the score is below 0.85. 4. Run a security scan (gitleaks + semgrep) in parallel with the eval gate. 5. Deploy to production only on push to main, only after eval and security pass. 6. Use OIDC for cloud authentication instead of static secrets. Output valid YAML. No placeholders.
Scan this entire repository for hardcoded secrets, API keys, tokens, and credentials. Check: source files, config files, .env files, MCP config files, docker-compose files, and CI/CD workflow files. Report every finding with the file path, line number, and the type of secret detected. If zero findings, confirm explicitly.
Write a rollback script for this deployment. Before any file is written to production, the script should save a copy of the current production version to a timestamped snapshot directory. The rollback command should restore every file from the most recent snapshot. Include error handling for partial restores. Output the script in the language this project uses.
After deployment completes, verify the production environment is healthy: 1. Fetch the deployed page/endpoint and confirm it returns HTTP 200. 2. Check that the response contains the expected content markers. 3. Measure response time and flag if it exceeds 3 seconds. 4. If any check fails, output a FAIL status with the specific failure. 5. If all pass, output PASS with the response time.
Audit the branch protection rules on this repository's main branch. Verify: pull requests are required, status checks are required and include build, eval, and security jobs, branches must be up to date, and force pushes are disabled. Report any gaps as actionable items.
What You Should Remember
- AI-generated code carries 2.7x higher vulnerability density and 1.7x more total issues than human-written code. Your pipeline gates must be stronger, not weaker.
- Six pipeline stages: source, build, test, eval gate, security scan, deploy. Cheap gates first.
- Branch protection is your last line of defense. No direct pushes to main. All status checks must pass.
- Never commit secrets. Use OIDC for cloud deployments. AI-assisted commits leak secrets at double the baseline rate.
- Snapshot before every deployment. Test your rollback before you need it.
- The four pillars: correct (evals), safe (security), traceable (git), shippable (deployment). All four must pass.
Ship It or Stop It
The deployment pipeline is not a formality. It is the gate between “this code exists” and “this code runs in production.” For AI-built code, where 81% of enterprise teams have already experienced production failures from AI-generated output, the pipeline is the single point where you enforce every quality standard you have. Build the pipeline. Gate it with evals, security, and git checks. Snapshot before you write. Monitor after you ship. The four pillars hold only if the deployment gate enforces them.
Frequently Asked Questions
FAQ
Because you did not write it line by line. AI-generated code carries 2.7x higher vulnerability density and introduces 1.7x more total issues than human-written code, according to 2025-2026 industry research. A standard pipeline that was safe for hand-written code is not sufficient. You need eval gates, automated security scanning, and mandatory review steps before anything reaches production.
CI/CD stands for Continuous Integration and Continuous Deployment. Continuous Integration means every code change is automatically built and tested when pushed. Continuous Deployment means passing code is automatically shipped to production. Vibe coders should care because you are shipping code at high velocity that you directed but did not manually verify every line of. CI/CD is how you automate the verification you cannot do by hand.
A GitHub Actions workflow is a YAML file in your repository's .github/workflows directory that defines an automated pipeline. It specifies triggers (on push, on pull_request), jobs (build, test, deploy), and steps within each job. GitHub Actions processes over 2 billion workflow runs per month as of 2025 and leads the CI/CD market at 33 percent adoption according to JetBrains.
Branch protection rules are GitHub settings that prevent direct pushes to critical branches like main. They require pull requests, passing status checks, and optionally code review approvals before code can be merged. For AI-built code, branch protection is your last line of defense: it ensures no code reaches production without passing your automated eval and security gates.
A canary deployment routes a small percentage of traffic (typically 1 to 5 percent) to the new version while the majority continues hitting the existing version. If error rates or latency spike in the canary, you roll back before the problem affects all users. It is named after the canary in a coal mine: a small exposure that detects danger before full commitment.
Blue-green deployment maintains two identical production environments. Blue runs the current version. Green runs the new version. You switch traffic from blue to green once green passes all health checks. If something breaks, you switch back to blue instantly. It provides zero-downtime deployments and instant rollback at the cost of running two environments.
Feature flags decouple deployment from release. You deploy code to production in a dormant state and control activation separately. This lets you ship code continuously without exposing unfinished features, perform targeted rollouts by user segment, and instantly disable a feature if it causes problems. Feature flags are now considered the primary tool for progressive delivery in 2026.
Never commit secrets to your repository. Use your CI/CD platform's encrypted secrets store (GitHub Actions secrets, for example). For cloud deployments, use OIDC (OpenID Connect) to generate short-lived credentials that expire automatically instead of storing long-lived API keys. In 2025, 28.65 million new hardcoded secrets were added to public GitHub commits, a 34 percent year-over-year increase according to GitGuardian.
OIDC (OpenID Connect) lets your CI/CD workflow request short-lived access tokens directly from your cloud provider instead of storing static credentials. The tokens expire automatically after minutes or hours, drastically reducing exposure if a secret leaks. GitHub Actions supports OIDC natively for AWS, Azure, and GCP. As of July 2026, GitHub uses immutable OIDC claims for new repositories to prevent spoofing.
The DDS deploy discipline is the deployment workflow used at Design Delight Studio. Build on a staging theme, render-verify with cache-busted URLs at three viewports, promote staging to MAIN using a script that asserts file-length parity between staging and MAIN, and keep a pre-change snapshot for instant rollback. It is the first-party worked Shopify example in this class.
A pre-deploy checklist should verify: all CI checks pass (build, lint, test, eval gate, security scan), no hardcoded secrets in the codebase, the staging environment renders correctly at all target viewports, the deployment script produces matching file lengths between staging and production, a rollback snapshot exists, and post-deploy monitoring is configured with defined alert thresholds.
Before every deployment, snapshot the current production state. For cloud services, use versioned deployments or container image tags. For Shopify themes, save a copy of every file being overwritten. If the deployment causes issues, restore from the snapshot. Automate this: your deploy script should create the snapshot before it writes anything, and your rollback script should be a single command that restores it.
Post-deploy observability means monitoring your application after deployment to catch problems that testing did not. Track error rates, response times, and key business metrics. Set alert thresholds so you are notified immediately if a deployment causes degradation. The DORA metrics recommend elite teams recover from failed deployments in under one hour, which requires observability to be in place before the deployment happens.
This is the fourth pillar. Evals (Class 71) makes your code correct. Security (Class 72) makes it safe. Git (Class 73) makes it traceable. Deployment (this class, 74) makes it shippable. Nothing deploys unless evals pass, the security scan passes, and the git history is clean. The deployment pipeline consumes the output of the other three.
Nothing. This masterclass is 100 percent free. No signup, no email, no paywall, no certificate requirement. It is part of the DDS Vibe Academy, a free AI coding curriculum built by Robert McCullock at Design Delight Studio.
