GitHub Actions CI/CD for React
Automate lint, test, build, and deploy steps in a GitHub Actions workflow on every push.
What Is GitHub Actions?
GitHub Actions is a CI/CD platform built into GitHub. Define workflows in YAML files under .github/workflows/ that run on push, pull request, or schedule events.
Basic CI Workflow
A minimal workflow that installs dependencies, runs linting, and runs tests on every push and pull request.
# .github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
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 lint
- run: npm test -- --coverageAll lessons in this course
- Deploying to Vercel: Zero-Config & Preview URLs
- Hosting a React SPA on AWS S3 & CloudFront
- Dockerizing a React/Next.js App
- GitHub Actions CI/CD for React