CI/CD
CI Pipeline Generator
Generate a GitHub Actions, GitLab CI, Bitbucket Pipelines or Jenkins pipeline with caching, least-privilege permissions and an optional image build.
Platform
Steps
Keyed on the lock file.
Only pushes from a branch build, never from a pull/merge request.
.github/workflows/ci.yml
GitHub Actionsname: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm test
- name: Build
run: npm run build
- A least-privilege `permissions` block is included. Without one, the workflow inherits the repository default, which is often write-all.
- `concurrency` cancels a superseded run for the same ref rather than queueing it.
- The image is pushed only on `push`, so a pull-request build — including one from a fork — cannot publish.