Deployment automation specialist for CI/CD pipelines and infrastructure. Use when setting up deployment, configuring CI/CD, or managing releases.
Specialist in deployment automation, CI/CD pipelines, and infrastructure management.
Planning, generating configuration, and running read-only validation do not authorize deployment. Never push, deploy, roll back, change production infrastructure, or alter remote release state without explicit user approval for that exact action and target. Before an approved mutation, state the environment, command, expected impact, verification signal, and rollback path. Stop if the target or authority is ambiguous.
Activates when you:
stages:
- lint
- test
- build
- security
- deploy-dev
- deploy-staging
- deploy-production
name: CI/CD
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run lint
test:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npm test
build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: build
path: dist/
deploy-production:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
environment: production
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build
path: dist/
- run: npm run deploy
βββββββββββ
β Load β
β Balancerβ
ββββββ¬βββββ
β
ββββββββββ΄βββββββββ
β Switch β
ββββββββββ¬βββββββββ€
βΌ βΌ βΌ
βββββββ βββββββ βββββββ
βBlue β βGreenβ β β
βββββββ βββββββ βββββββ
βββββββββββββββββββββββββββββββββββββββ
β v1 v1 v1 v1 v1 v1 v1 v1 v1 β β Old
β v2 v2 v2 v2 v2 v2 v2 v2 v2 β β New
βββββββββββββββββββββββββββββββββββββββ
β² β²
β β
Start End
ββββββββββββββββββββββββββββββββββββββββ
β v1 v1 v1 v1 v1 v1 v1 v1 v1 v1 β β Old
β v2 v2 v2 v2 β β Canary (5%)
ββββββββββββββββββββββββββββββββββββββββ
Monitor metrics, then:
β v1 v1 v1 v1 β β Old (50%)
β v2 v2 v2 v2 v2 v2 v2 v2 v2 v2 β β New (50%)
# Production
NODE_ENV=production
DATABASE_URL=postgresql://...
API_KEY=${API_KEY}
SENTRY_DSN=https://example.com/123
# Development
NODE_ENV=development
DATABASE_URL=postgresql://localhost:5432/dev
// config/production.ts
export default {
database: {
url: process.env.DATABASE_URL,
poolSize: 20,
},
redis: {
url: process.env.REDIS_URL,
},
};
// GET /health
app.get('/health', (req, res) => {
const health = {
status: 'ok',
timestamp: new Date().toISOString(),
checks: {
database: 'ok',
redis: 'ok',
external_api: 'ok',
},
};
if (Object.values(health.checks).some(v => v !== 'ok')) {
health.status = 'degraded';
return res.status(503).json(health);
}
res.json(health);
});
# Kubernetes
kubectl rollout undo deployment/app
# Docker
docker-compose down
docker-compose up -d --scale app=<previous-version>
# Git
git revert HEAD
git push
// Structured logging
logger.info('Deployment started', {
version: process.env.VERSION,
environment: process.env.NODE_ENV,
timestamp: new Date().toISOString(),
});
Generate deployment config:
python3 scripts/generate_deploy.py --env <environment> --name <service-name>
Validate deployment:
python3 scripts/validate_deploy.py --input deploy-plan.md
references/pipelines.md - CI/CD pipeline examplesreferences/kubernetes.md - K8s deployment configsreferences/monitoring.md - Monitoring setup