What is CI/CD?
Continuous Integration (CI) automatically tests every code push. Continuous Deployment (CD) automatically deploys passing builds to production. Together, they eliminate manual deployment steps and catch bugs before they reach users.
GitHub Actions Workflow
Create .github/workflows/deploy.yml:
name: Build & Deploy
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm ci
- run: npm run lint
- run: npm run build
- run: npm run test
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
Adding Linting and Type Checks
Always include npm run lint and npm run typecheck in your CI pipeline. These catch formatting issues, unused imports, and type errors before they reach production.
Deployment Targets
GitHub Actions can deploy to Vercel, Netlify, AWS S3+CloudFront, any VPS via SSH, or Kubernetes clusters. The flexibility makes it the go-to CI/CD tool for modern web teams.