Supabase Blog

CI/CD with GitHub Actions

0 views

CI/CD with GitHub Actions

GitHub Actions lets you automate build, test, and deploy directly from your GitHub repository.

Concepts

  • Workflow: Defined in .github/workflows/*.yml; runs on events (push, PR, schedule).
  • Job: Set of steps that run on the same runner.
  • Step: A single task (run a script, use an action).

Example: Node.js test on push

name: CI
on:
  push:
    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 test
      - run: npm run build

Common actions

  • actions/checkout – clone repo
  • actions/setup-node – Node.js
  • actions/setup-python – Python
  • docker/build-push-action – build and push images

Add this file under .github/workflows/ci.yml and push to trigger the workflow. Check the Actions tab for logs.