name: CI
on:
push:
branches: [main]
pull_request:
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 test
- run: npm run buildenv:
API_KEY: ${{ secrets.API_KEY }}Teach: Settings → Secrets, never commit values.
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY . .
EXPOSE 3000
CMD ["node", "server.js"]Terms: image (recipe result), container (running instance).
Require CI green before merge — teach on GitHub/GitLab when user uses PRs.
| Stage | Catches |
|---|---|
| lint | style, some bugs |
| test | logic regressions |
| build | compile/bundle errors |
| audit | known vuln deps |
| deploy | only if all green |