/lovable-issues

Adding CI/CD Workflows for Lovable Projects

Explore manual CI/CD workflows for lovable projects: learn why they matter, build pipelines, and apply best practices.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

Why CI/CD Workflows Must Be Manually Configured for Lovable

Because Lovable is an editor/cloud-first environment without a built-in CI runner or terminal, CI/CD pipelines must be set up where builds and deploys actually run (GitHub Actions, Vercel, Netlify, etc.). Lovable’s Preview/Publish, Secrets UI, and GitHub sync are for editing, cloud previews, and exporting source — they do not substitute for an externally hosted continuous integration pipeline that runs tests, builds, and deploy steps on reproducible runners with configured env vars and secrets. Therefore CI/CD must be manually configured outside Lovable (or in the connected Git repo) so the pipeline has the right runners, environment, and access to third‑party services.

 

Why this is true — detailed reasons

 

  • No terminal / no persistent runner inside Lovable. You can’t run shell scripts, npm scripts, or persistent agents inside Lovable’s editor. CI pipelines need a runner (hosted or self‑hosted) to execute builds and tests.
  • Publish/Preview ≠ CI. Lovable’s Preview and Publish produce cloud previews or push to Lovable Cloud, but they don’t run user-defined build/test workflows, orchestrate multi-step deploys, or run in the same reproducible environment as CI runners.
  • Secrets and environment scope differ. Lovable’s Secrets UI stores values for Lovable Cloud runs. CI systems require you to configure secrets in the CI provider (GitHub Actions secrets, Vercel environment variables), and you must map those values manually to the runner environment.
  • External deploy targets require external access. Deploying to services (Kubernetes, cloud providers, container registries) needs credentials and network access that CI runners provide; Lovable doesn’t host those runners.
  • Reproducibility and branching. CI workflows run on specific commits/branches using specified runner images and toolchains. To ensure the same build/test behavior across contributors you must codify and configure pipelines in the remote CI system.
  • GitHub sync/export splits responsibilities. Lovable can export or sync to GitHub, but once code lives in GitHub, CI needs to be created there (or in your chosen provider). That configuration is intentionally manual because it involves external secrets, runner selection, and deploy permissions.
  • What commonly breaks if you assume Lovable handles CI. Missing env vars in CI, build tools not installed on the chosen runner, migrations that require DB access, or expecting Publish to run test suites — all of these happen when people assume Lovable replaces a CI system.

 

Lovable prompt to add this explanation into the repo (create a docs file)

 

// Create a new file at docs/WHY_CICD_IS_MANUAL.md with the following content.
// Update README.md to add a short link to this docs file near deployment/CI notes.

Create file: docs/WHY_CICD_IS_MANUAL.md

Content:
# Why CI/CD Workflows Must Be Manually Configured for Lovable

Because Lovable is an editor/cloud-first environment without a built-in CI runner or terminal, CI/CD pipelines must be set up where builds and deploys actually run (GitHub Actions, Vercel, Netlify, etc.). Lovable’s Preview/Publish, Secrets UI, and GitHub sync are for editing, cloud previews, and exporting source — they do not substitute for an externally hosted continuous integration pipeline that runs tests, builds, and deploy steps on reproducible runners with configured env vars and secrets. Therefore CI/CD must be manually configured outside Lovable (or in the connected Git repo) so the pipeline has the right runners, environment, and access to third‑party services.

## Key reasons
- No terminal / no persistent runner inside Lovable: CI pipelines need a runner to execute builds/tests.
- Publish/Preview != CI: Lovable previews are not substitute for multi-step build/test/deploy workflows.
- Secrets and environment scope differ: CI providers require secrets configured in their UI and mapped into the runner environment.
- External deploy targets need external access and credentials only available to CI runners.
- Reproducibility and branching need explicit pipeline configuration tied to commits/branches.
- GitHub sync/export hands off execution responsibility to the git hosting provider — CI must be created there.
- Common breakages: missing env vars, unavailable build tools, DB migrations requiring network access, expecting Publish to run test suites.

## How this file should be used
- Point team members here when they ask "why doesn't Lovable run my tests on publish?"
- Use it as the single source of truth explaining where to configure CI and where secrets must be set (CI provider / hosting provider).

End of file

// Also update README.md: add a short sentence under "Deployment" linking to docs/WHY_CICD_IS_MANUAL.md.

 

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

How to Build CI/CD Pipelines for Lovable Projects

 

Direct answer

 

Use Lovable Chat edits to add CI files (workflow YAMLs and package.json scripts), store runtime secrets in Lovable Secrets UI, then use Lovable’s GitHub export/sync to run CI/CD in GitHub Actions. Create .github/workflows/ci.yml and (optionally) .github/workflows/deploy.yml inside the project via Chat Mode edits, update package.json scripts, and add instructions for which repository secrets to copy into GitHub (these must be pasted into GitHub because Lovable has no terminal).

 

Step‑by‑step Lovable prompts to paste into Lovable Chat

 

  • Prompt A — Add a basic CI workflow that installs, caches, runs tests, and builds
// Please create a new file at .github/workflows/ci.yml with the exact contents below.
// This workflow runs on push and pull_request, installs Node, caches npm, runs tests and builds.

name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Use Node.js 18
        uses: actions/setup-node@v4
        with:
          node-version: 18
          cache: "npm"

      - name: Install dependencies
        run: npm ci

      - name: Run tests
        run: npm test

      - name: Build
        run: npm run build

      - name: Upload build artifact
        uses: actions/upload-artifact@v4
        with:
          name: build
          path: |
            ./build
            ./dist

 

  • Prompt B — Add a deploy job scaffold (provider-specific steps will require GitHub secrets)
// Please append a new workflow file at .github/workflows/deploy.yml.
// This scaffold builds on push to main and includes a placeholder deploy step that uses a secret DEPLOY_TOKEN.
// I want you to keep the deploy step generic and comment where provider-specific actions should go.

name: Deploy

on:
  push:
    branches: [ main ]

jobs:
  deploy:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Use Node.js 18
        uses: actions/setup-node@v4
        with:
          node-version: 18

      - name: Install and build
        run: |
          npm ci
          npm run build

      - name: Deploy (placeholder)
        env:
          DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} // // Provide this secret in GitHub; provider-specific steps go here
        run: |
          echo "Replace this step with provider-specific deployment action"
          # // Example: use vercel/action@v20 or netlify/actions@v1 with tokens stored in GitHub Secrets

 

  • Prompt C — Update package.json with standard scripts if missing
// Please modify package.json in the repository root: add or update the "scripts" block so it includes test, build and ci.
// If package.json already has scripts, merge (do not delete) other existing scripts.

{
  "scripts": {
    // // run tests in CI
    "test": "npm run test:unit || echo \"no test script defined\"",
    // // build for production
    "build": "react-scripts build || next build || vite build || echo \"define a build script\"",
    // // convenience alias for CI
    "ci": "npm ci && npm run test && npm run build"
  }
}

 

  • Prompt D — Add developer instructions file (CI / secrets checklist)
// Please create a file at docs/CI-README.md with explicit steps developers should follow after we export to GitHub.
// Include which GitHub secrets to add (names and purpose) and which external provider setup is required.

# CI Checklist

// // Add these secrets to GitHub repository Settings > Secrets > Actions
// DEPLOY_TOKEN - token for your deployment provider (Vercel/Netlify/SSH key wrapped)
// DATABASE_URL - runtime database URL for integration tests (optional)
// SUPABASE_SERVICE_ROLE - only if migrations are run in CI

// // Provider notes:
// // - For Vercel: use VERCEL_TOKEN and install Vercel GitHub App or use vercel/action in deploy.yml
// // - For Netlify: use NETLIFY_AUTH_TOKEN and NETLIFY_SITE_ID
// // - For SSH deploy: store SSH_PRIVATE_KEY in GitHub secrets and use webfactory/ssh-agent action

 

Practical notes and external steps

 

  • Use Lovable Secrets UI for runtime secrets — add environment variables you need at runtime via Lovable Cloud Secrets so Publish/Preview works inside Lovable.
  • GitHub secrets and Actions run outside Lovable — after using Lovable’s GitHub export/sync to push these files, open the GitHub repo and add the listed secrets (DEPLOY\_TOKEN, provider tokens). This step is outside Lovable (no terminal needed, use GitHub UI).
  • If CI requires CLI-only steps (migrations, custom SSH setup) — include scaffolding and comments in the workflows and docs; perform any testing of those commands in your local terminal or in a dedicated runner configured in GitHub.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Best Practices for Adding CI/CD to Lovable Projects

The short answer: add small, focused CI files and npm scripts inside your Lovable project, keep secrets in Lovable Cloud for Preview/Publish, use GitHub Actions YAML placed at .github/workflows/ci.yml for longer-running or team-shared CI, cache deps and run only unit tests/builds on push, and add an integration/manual workflow for heavy tasks. Use Lovable’s chat edits and Secrets UI to make changes; only add repo-level GitHub Secrets outside Lovable (via GitHub settings) when a workflow needs them.

 

Create lightweight CI files and npm scripts

 

Best practice: update package.json to expose scripts CI can run (test, lint, build). Then add a GitHub Actions workflow file to .github/workflows/ci.yml that uses caching and runs only fast checks on push.

  • Paste this prompt into Lovable chat to implement these files and edits:
// Edit package.json at the project root:
// - add scripts: "test", "lint", "build"
// - keep existing fields intact
Please update package.json to add common CI scripts used by GitHub Actions and Lovable Preview:
- update root package.json: add or update the "scripts" block so it contains:
  "test": "npm test --silent", // run unit tests
  "lint": "eslint . --ext .js,.ts,.tsx || true", // lint but don't fail CI on missing config
  "build": "npm run build" // keep existing build if present
// If package.json has a different test command, preserve content and ensure "test" exists.
Create the file .github/workflows/ci.yml with the following content:
name: CI
on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]
jobs:
  node-ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          cache: 'npm'
      - name: Install dependencies
        run: npm ci
      - name: Run lint
        run: npm run lint
      - name: Run tests
        run: npm run test
      - name: Build
        run: npm run build
// Add comments in the file to explain each step.

 

Configure secrets and environment safely

 

Best practice: use Lovable Cloud Secrets for Preview/Publish runtime values and keep a .env.example in repo. For CI running in GitHub Actions, mirror only the minimal secrets to GitHub Secrets (this step is outside Lovable).

  • Paste this prompt into Lovable chat to add .env.example and set Lovable Secrets:
// Create or update .env.example at project root listing required env vars:
// Example content:
# .env.example
NEXT_PUBLIC_API_URL=https://api.example.com
DATABASE_URL=postgres://user:pass@host/db
SUPABASE_SERVICE_KEY=your-service-key-here

// Then instruct Lovable to add secrets in its Secrets UI:
// Please create Lovable Cloud secrets named:
// - DATABASE_URL
// - SUPABASE_SERVICE_KEY
// - NEXT_PUBLIC_API_URL
// Set placeholders now; I'll add real values in the Secrets UI when ready.

 

Use manual or scheduled workflows for heavy tasks and keep CI fast

 

  • Best practice: put long integration tests, e2e, or deployment steps into separate workflows triggered by workflow\_dispatch or schedule so normal pushes stay fast.
  • Prompt to add a manual integration workflow:
// Create file .github/workflows/integration.yml with a workflow_dispatch trigger:
// This keeps main CI fast and runs heavy tests only manually or on schedule.
name: Integration Tests
on:
  workflow_dispatch: {}
  schedule:
    - cron: '0 4 * * 0' // optional weekly run
jobs:
  integration:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '18'
      - run: npm ci
      - run: npm run build
      - run: npm run test:integration || true // mark as optional if missing

 

Practical notes and what must be done outside Lovable

 

  • Use Lovable Preview to sanity-check environment/secret wiring before pushing CI changes.
  • GitHub Secrets: if your workflow needs secrets inside GitHub Actions (e.g., SUPABASE_SERVICE_KEY for tests), add them in the repository Settings → Secrets on GitHub — this step is outside Lovable and requires repo permissions.
  • Push to GitHub: create the files above inside Lovable and then Publish / Sync to GitHub so Actions can run. If you need terminal steps to configure runners or external tools, do those outside Lovable.

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022