Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ npx @capgo/cli@latest bundle upload --channel=production

The missing piece is not another terminal command inside Lovable. **Lovable cannot run Capgo on Publish.** When GitHub sync is enabled, **Publish pushes a commit to your repo**. GitHub Actions runs the build and `bundle upload` for you.

This guide covers the only manual setup your client must do once: add `CAPGO_TOKEN` as a GitHub secret. Everything else can be added with a Lovable prompt or a small workflow file.
This guide covers the only manual setup your client must do once: add `CAPGO_TOKEN` as a GitHub secret. For the workflow file, copy-paste the ready AI instruction into Lovable (Step 3).

## How the pipeline works

Expand Down Expand Up @@ -69,29 +69,59 @@ GitHub injects the secret into workflows as `${{ secrets.CAPGO_TOKEN }}`. The wo

If the repo is under your client's organization, they must add the secret on **their** repo. You only need the key in GitHub, not in Lovable settings.

## Step 3 — Add the GitHub Actions workflow
## Step 3 — Paste this prompt into Lovable

### Option A — Ask Lovable to create the file

Paste this into Lovable chat (adjust branch name if your default is not `main`):
Copy the block below into the Lovable chat. If your default branch is not `main`, replace `main` in the workflow with your branch name.

```text
Create `.github/workflows/capgo-live-updates.yml` that runs on every push to `main`:
Add Capgo Live Updates CI with GitHub Actions.

Create `.github/workflows/capgo-live-updates.yml` (create folders if needed). Start from this YAML, then adapt install/build to this project while keeping Capgo upload + CAPGO_TOKEN secret behavior:

name: Capgo Live Updates

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6

1. Checkout code
2. Setup Node.js 24 with npm cache
3. Run `npm ci` and `npm run build`
4. Run `npx @capgo/cli@latest bundle upload --channel=production`
5. Use environment variable `CAPGO_TOKEN` from GitHub Actions secrets (do not hardcode the API key)
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'

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

- name: Upload bundle to Capgo
run: npx @capgo/cli@latest bundle upload --channel=production
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

Use `actions/checkout@v6` and `actions/setup-node@v6`. Commit the workflow file to the repo.
Rules:
- Do not hardcode any Capgo API key in the repo or in chat.
- The workflow must read CAPGO_TOKEN only from GitHub Actions secrets (`${{ secrets.CAPGO_TOKEN }}`).
- Prefer the project's real production build script from package.json (for example `npm run build` or `vite build`).
- If package-lock.json is missing, use `npm install` instead of `npm ci`.
- Do not modify app UI or Capacitor config for this task.
- Commit the workflow file so the next Publish pushes it to GitHub.
```

Lovable will add the YAML and push it on the next Publish.
After Lovable applies the change, click **Publish** so the workflow lands on GitHub.

### Option B — Add the file yourself
### Manual alternative

Create `.github/workflows/capgo-live-updates.yml`:
If you prefer not to use the Lovable chat, create `.github/workflows/capgo-live-updates.yml` with this YAML only (not the prompt prose). Adapt the install/build steps the same way as the rules above if your project differs, then commit and push.

```yaml
name: Capgo Live Updates
Expand Down Expand Up @@ -125,9 +155,7 @@ jobs:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
```

Commit and push. The first run starts as soon as GitHub receives the push.

**Vite `base` path:** Lovable Vite apps often need `base: './'` in `vite.config.ts` so assets load inside the native shell. If users see a white screen after an OTA update, fix `base`, publish again, and let the workflow redeploy.
**Vite `base` path:** Lovable Vite apps often need `base: './'` in `vite.config.ts` so assets load inside the native shell. If users see a white screen after an OTA update, ask Lovable to set `base: './'`, publish again, and let the workflow redeploy.
Comment thread
riderx marked this conversation as resolved.

**Encrypted bundles:** If you use [Capgo encryption](/docs/live-updates/encryption/), add `CAPGO_PRIVATE_KEY` as a second GitHub secret and pass `--key-data-v2 "${{ secrets.CAPGO_PRIVATE_KEY }}"` on the upload step.

Expand Down
Loading