logo
Parslinks
Back to blog
Guides4 min read

CI/CD for small teams: GitHub Actions, GitLab CI, or deploying straight from Git?

CI doesn't have to do everything. Separate testing from deployment and both get simpler.

Alireza Tadi

Co-founder, Parslinks · Team, marketing & infrastructure

At an online-learning startup, the deploy.yml in GitHub Actions is over 200 lines. It runs tests, builds the project, SSHes into the server, copies files with rsync, runs migrations and restarts the service. The production server's SSH key and the database password sit in the repo's secrets. The person who wrote it left six months ago. Every time something in that chain breaks, the whole team spends an afternoon reading Actions logs.

The problem isn't GitHub Actions. It's one file doing two completely different jobs.

CI and CD are two separate jobs

CI (continuous integration) asks: "Is this change sound?" Lint, tests, type checks, a trial build. The answer is green or red.

CD (continuous delivery/deployment) asks: "How do we get this version to users?" Building the artifact, previews, promotion to production, rollback.

When both live in one file, CI gets access to production keys, and any change to the test process carries deploy risk too.

How work splits between CI and the deploy platform

A workflow that works today

CI only runs checks. It needs no production keys:

.github/workflows/ci.yml
name: ci
on:
  pull_request:
  push:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with:
          node-version-file: .nvmrc
          cache: pnpm
      - run: pnpm install --frozen-lockfile
      - run: pnpm lint
      - run: pnpm typecheck
      - run: pnpm test -- --run
yaml20 lines

The platform handles deployment: every push to any branch builds a preview, and merging into main builds production. Connect two things:

  1. A GitHub branch rule: merging into main is only allowed when CI is green (branch protection, "Require status checks").
  2. Review on the preview: put the preview link in the PR so someone has seen the real thing before merging.

The result: no code reaches production without green tests and a human look, and your YAML is twenty lines, not two hundred.

GitLab CI

Same logic if your repo is on GitLab or a self-hosted GitLab:

.gitlab-ci.yml
test:
  image: node:22
  cache:
    paths: [.pnpm-store]
  script:
    - corepack enable
    - pnpm config set store-dir .pnpm-store
    - pnpm install --frozen-lockfile
    - pnpm lint && pnpm typecheck && pnpm test -- --run
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == "main"
yaml12 lines

Where should migrations run?

Not in CI. CI shouldn't have access to the production database. Migrations are part of deployment and should run where production variables live: as a step before traffic switches to the new version.

Where to start

If you have no CI today: create a workflow with lint and tests and turn on branch protection. If you have a 200-line CI: split the deploy part out, remove SSH keys and production passwords from the repo's secrets (and rotate them), and hand deployment to the platform.

Frequently asked questions

Join the discussion

No comments yet. Be the first to share your thoughts.