Content
GitHub Actions CI
Automate testing, building, and deploying with GitHub Actions for pnpm/Next.js projects and beyond.
When to use
- Every repo with tests, linting, or type-checking that needs automated quality gates
- Projects deploying to Vercel, AWS, or any cloud provider
- Monorepos needing coordinated build/test across packages
- Libraries publishing to npm or GitHub Packages
When NOT to use
- Tiny scripts with no tests or deployment target
- Repos locked into another CI provider where migration cost exceeds benefit
- Builds requiring hardware GitHub-hosted runners cannot provide (use self-hosted instead)
Core concepts
A workflow is a YAML file in .github/workflows/ composed of triggers (on), jobs (parallel VMs), steps (sequential commands), and actions (reusable units). Caching restores files between runs using keys derived from lockfile hashes — cache hits skip expensive install/build steps.
| Primitive | Purpose |
|---|---|
on.push / on.pull_request | Trigger on code changes |
on.workflow_dispatch | Manual trigger with inputs |
on.schedule | Cron-based trigger |
jobs.<id>.strategy.matrix | Fan out across Node versions/OSes |