Install dependencies, lint, test, and build a Node project.
Section: Testing and build pipelines
Node.js CI workflow
yaml
yaml
name: Node CI
on:
push:
branches: [main]
pull_request:
jobs:
ci:
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 lint
- run: npm test -- --ci
- run: npm run buildExplanation
This is a solid baseline CI workflow for Node-based apps and libraries.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Testing and build pipelines
Create a GitHub release on tag push
Publish a release whenever a version tag is pushed.
Deploy only from main after tests
Gate deployments on successful CI from the main branch.