capgo-live-updates by cap-go/capgo-skills
npx skills add https://github.com/cap-go/capgo-skills --skill capgo-live-updates无需等待应用商店审核,即刻向您的 Capacitor 应用部署更新。
Capgo 是一个用于 Capacitor 应用的实时更新服务,它允许您:
注意:原生代码变更(Swift/Kotlin/Java)仍需要提交到应用商店。
npm install -g @capgo/cli
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
capgo login
# 打开浏览器进行身份验证
或者使用 API 密钥:
capgo login --apikey YOUR_API_KEY
cd your-capacitor-app
capgo init
这将:
@capgo/capacitor-updater 添加到您的项目如果未自动安装:
npm install @capgo/capacitor-updater
npx cap sync
// capacitor.config.ts
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.yourapp.id',
appName: 'Your App',
webDir: 'dist',
plugins: {
CapacitorUpdater: {
autoUpdate: true, // 启用自动更新
},
},
};
export default config;
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: true,
// 更新行为
resetWhenUpdate: true, // 原生更新时重置为内置版本
updateUrl: 'https://api.capgo.app/updates', // 默认值
statsUrl: 'https://api.capgo.app/stats', // 分析数据
// 渠道
defaultChannel: 'production',
// 更新时间
periodCheckDelay: 600, // 每 10 分钟检查一次(秒)
delayConditionsFail: false, // 条件失败时不延迟
// 私有更新(企业版)
privateKey: 'YOUR_PRIVATE_KEY', // 用于加密更新
},
},
设置 autoUpdate: true,更新将自动进行:
// app.ts - 只需在就绪时通知
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// 告知 Capgo 应用已成功加载
// 必须在应用启动后 10 秒内调用
CapacitorUpdater.notifyAppReady();
重要:务必调用 notifyAppReady()。如果在 10 秒内未调用,Capgo 会认为更新失败并执行回滚。
如需更多控制:
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: false, // 禁用自动更新
},
},
// update-service.ts
import { CapacitorUpdater } from '@capgo/capacitor-updater';
class UpdateService {
async checkForUpdate() {
// 检查是否有可用更新
const update = await CapacitorUpdater.getLatest();
if (!update.url) {
console.log('没有可用更新');
return null;
}
console.log('有可用更新:', update.version);
return update;
}
async downloadUpdate(update: any) {
// 下载更新包
const bundle = await CapacitorUpdater.download({
url: update.url,
version: update.version,
});
console.log('已下载:', bundle.id);
return bundle;
}
async installUpdate(bundle: any) {
// 设置为下一个版本(在下次应用启动时生效)
await CapacitorUpdater.set(bundle);
console.log('更新将在下次重启时应用');
}
async installAndReload(bundle: any) {
// 设置并立即重新加载
await CapacitorUpdater.set(bundle);
await CapacitorUpdater.reload();
}
}
import { CapacitorUpdater } from '@capgo/capacitor-updater';
import { Dialog } from '@capacitor/dialog';
async function checkUpdate() {
const update = await CapacitorUpdater.getLatest();
if (!update.url) return;
const { value } = await Dialog.confirm({
title: '有可用更新',
message: `版本 ${update.version} 已可用。现在更新吗?`,
});
if (value) {
// 显示加载指示器
showLoading('正在下载更新...');
const bundle = await CapacitorUpdater.download({
url: update.url,
version: update.version,
});
hideLoading();
// 应用并重新加载
await CapacitorUpdater.set(bundle);
await CapacitorUpdater.reload();
}
}
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// 更新已下载
CapacitorUpdater.addListener('updateAvailable', (info) => {
console.log('有可用更新:', info.bundle.version);
});
// 下载进度
CapacitorUpdater.addListener('downloadProgress', (progress) => {
console.log('下载进度:', progress.percent, '%');
});
// 更新失败
CapacitorUpdater.addListener('updateFailed', (info) => {
console.error('更新失败:', info.bundle.version);
});
// 应用就绪
CapacitorUpdater.addListener('appReady', () => {
console.log('应用已就绪');
});
# 构建您的 Web 应用
npm run build
# 上传到 Capgo
capgo upload
# 上传到特定渠道
capgo upload --channel beta
# 上传指定版本
capgo upload --bundle 1.2.3
# .github/workflows/deploy.yml
name: 部署到 Capgo
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: 安装依赖
run: npm install
- name: 构建
run: npm run build
- name: 部署到 Capgo
run: npx @capgo/cli bundle upload
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
# .gitlab-ci.yml
deploy:
stage: deploy
image: node:20
script:
- npm install
- npm run build
- npx @capgo/cli bundle upload
only:
- main
variables:
CAPGO_TOKEN: $CAPGO_TOKEN
# 创建 beta 渠道
capgo channel create beta
# 创建 staging 渠道
capgo channel create staging
# 部署到 beta(内部测试)
capgo upload --channel beta
# 推广到生产环境
capgo upload --channel production
在 Capgo 仪表板中:
// 将设备分配到渠道
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// 针对 beta 测试者
await CapacitorUpdater.setChannel({ channel: 'beta' });
// 针对生产环境用户
await CapacitorUpdater.setChannel({ channel: 'production' });
如果 notifyAppReady() 在 10 秒内未被调用,Capgo 会自动回滚到之前可用的版本。
# 列出可用版本
capgo bundle list
# 回滚到特定版本
capgo bundle revert --bundle 1.2.2 --channel production
// 获取已下载的包列表
const bundles = await CapacitorUpdater.list();
// 回滚到内置版本
await CapacitorUpdater.reset();
// 删除特定包
await CapacitorUpdater.delete({ id: 'bundle-id' });
针对企业或隐私要求:
# 安装自托管的 Capgo
docker run -d \
-p 8080:8080 \
-e DATABASE_URL=postgres://... \
capgo/capgo-server
配置应用以使用自托管服务:
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: true,
updateUrl: 'https://your-server.com/updates',
statsUrl: 'https://your-server.com/stats',
},
},
对于敏感应用,启用加密:
# 生成密钥对
capgo key create
# 使用加密上传
capgo upload --key-v2
在应用中配置:
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: true,
privateKey: 'YOUR_PRIVATE_KEY',
},
},
验证更新来自可信来源:
# 签名包
capgo upload --sign
# 在应用中验证签名
capgo key verify
在 Capgo 仪表板中,查看:
// 跟踪自定义事件
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// 获取当前包信息
const current = await CapacitorUpdater.current();
console.log('当前版本:', current.bundle.version);
// 获取下载统计信息
const stats = await CapacitorUpdater.getBuiltinVersion();
notifyAppReady()notifyAppReady() 之前崩溃notifyAppReady()notifyAppReady() - 应用初始化后第一件事每周安装量
80
代码仓库
GitHub Stars
20
首次出现
2026年2月6日
安全审计
安装于
gemini-cli78
opencode77
codex75
github-copilot74
kimi-cli72
amp71
Deploy updates to your Capacitor app instantly without waiting for app store review.
Capgo is a live update service for Capacitor apps that lets you:
Note : Native code changes (Swift/Kotlin/Java) still require app store submission.
npm install -g @capgo/cli
capgo login
# Opens browser to authenticate
Or use API key:
capgo login --apikey YOUR_API_KEY
cd your-capacitor-app
capgo init
This will:
@capgo/capacitor-updater to your projectIf not installed automatically:
npm install @capgo/capacitor-updater
npx cap sync
// capacitor.config.ts
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.yourapp.id',
appName: 'Your App',
webDir: 'dist',
plugins: {
CapacitorUpdater: {
autoUpdate: true, // Enable automatic updates
},
},
};
export default config;
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: true,
// Update behavior
resetWhenUpdate: true, // Reset to built-in on native update
updateUrl: 'https://api.capgo.app/updates', // Default
statsUrl: 'https://api.capgo.app/stats', // Analytics
// Channels
defaultChannel: 'production',
// Update timing
periodCheckDelay: 600, // Check every 10 minutes (seconds)
delayConditionsFail: false, // Don't delay on condition fail
// Private updates (enterprise)
privateKey: 'YOUR_PRIVATE_KEY', // For encrypted updates
},
},
With autoUpdate: true, updates are automatic:
// app.ts - Just notify when ready
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Tell Capgo the app loaded successfully
// This MUST be called within 10 seconds of app start
CapacitorUpdater.notifyAppReady();
Important : Always call notifyAppReady(). If not called within 10 seconds, Capgo assumes the update failed and rolls back.
For more control:
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: false, // Disable auto updates
},
},
// update-service.ts
import { CapacitorUpdater } from '@capgo/capacitor-updater';
class UpdateService {
async checkForUpdate() {
// Check for available update
const update = await CapacitorUpdater.getLatest();
if (!update.url) {
console.log('No update available');
return null;
}
console.log('Update available:', update.version);
return update;
}
async downloadUpdate(update: any) {
// Download the update bundle
const bundle = await CapacitorUpdater.download({
url: update.url,
version: update.version,
});
console.log('Downloaded:', bundle.id);
return bundle;
}
async installUpdate(bundle: any) {
// Set as next version (applies on next app start)
await CapacitorUpdater.set(bundle);
console.log('Update will apply on next restart');
}
async installAndReload(bundle: any) {
// Set and reload immediately
await CapacitorUpdater.set(bundle);
await CapacitorUpdater.reload();
}
}
import { CapacitorUpdater } from '@capgo/capacitor-updater';
import { Dialog } from '@capacitor/dialog';
async function checkUpdate() {
const update = await CapacitorUpdater.getLatest();
if (!update.url) return;
const { value } = await Dialog.confirm({
title: 'Update Available',
message: `Version ${update.version} is available. Update now?`,
});
if (value) {
// Show loading indicator
showLoading('Downloading update...');
const bundle = await CapacitorUpdater.download({
url: update.url,
version: update.version,
});
hideLoading();
// Apply and reload
await CapacitorUpdater.set(bundle);
await CapacitorUpdater.reload();
}
}
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Update downloaded
CapacitorUpdater.addListener('updateAvailable', (info) => {
console.log('Update available:', info.bundle.version);
});
// Download progress
CapacitorUpdater.addListener('downloadProgress', (progress) => {
console.log('Download:', progress.percent, '%');
});
// Update failed
CapacitorUpdater.addListener('updateFailed', (info) => {
console.error('Update failed:', info.bundle.version);
});
// App ready
CapacitorUpdater.addListener('appReady', () => {
console.log('App is ready');
});
# Build your web app
npm run build
# Upload to Capgo
capgo upload
# Upload to specific channel
capgo upload --channel beta
# Upload with version
capgo upload --bundle 1.2.3
# .github/workflows/deploy.yml
name: Deploy to Capgo
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy to Capgo
run: npx @capgo/cli bundle upload
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}
# .gitlab-ci.yml
deploy:
stage: deploy
image: node:20
script:
- npm install
- npm run build
- npx @capgo/cli bundle upload
only:
- main
variables:
CAPGO_TOKEN: $CAPGO_TOKEN
# Create beta channel
capgo channel create beta
# Create staging channel
capgo channel create staging
# Deploy to beta (internal testing)
capgo upload --channel beta
# Promote to production
capgo upload --channel production
In Capgo dashboard:
// Assign device to channel
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// For beta testers
await CapacitorUpdater.setChannel({ channel: 'beta' });
// For production users
await CapacitorUpdater.setChannel({ channel: 'production' });
If notifyAppReady() isn't called within 10 seconds, Capgo automatically rolls back to the previous working version.
# List available versions
capgo bundle list
# Rollback to specific version
capgo bundle revert --bundle 1.2.2 --channel production
// Get list of downloaded bundles
const bundles = await CapacitorUpdater.list();
// Rollback to built-in version
await CapacitorUpdater.reset();
// Delete a specific bundle
await CapacitorUpdater.delete({ id: 'bundle-id' });
For enterprise or privacy requirements:
# Install self-hosted Capgo
docker run -d \
-p 8080:8080 \
-e DATABASE_URL=postgres://... \
capgo/capgo-server
Configure app to use self-hosted:
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: true,
updateUrl: 'https://your-server.com/updates',
statsUrl: 'https://your-server.com/stats',
},
},
For sensitive apps, enable encryption:
# Generate key pair
capgo key create
# Upload with encryption
capgo upload --key-v2
Configure in app:
// capacitor.config.ts
plugins: {
CapacitorUpdater: {
autoUpdate: true,
privateKey: 'YOUR_PRIVATE_KEY',
},
},
Verify updates are from trusted source:
# Sign bundle
capgo upload --sign
# Verify signature in app
capgo key verify
In Capgo dashboard, view:
// Track custom events
import { CapacitorUpdater } from '@capgo/capacitor-updater';
// Get current bundle info
const current = await CapacitorUpdater.current();
console.log('Current version:', current.bundle.version);
// Get download stats
const stats = await CapacitorUpdater.getBuiltinVersion();
notifyAppReady() is callednotifyAppReady()notifyAppReady() is called earlynotifyAppReady() - First thing after app initializesWeekly Installs
80
Repository
GitHub Stars
20
First Seen
Feb 6, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
gemini-cli78
opencode77
codex75
github-copilot74
kimi-cli72
amp71
Sentry React Native SDK 设置指南:React Native/Expo 错误监控、性能追踪与回放
433 周安装
开发收尾确认技能:自动化验证测试、代码质量与构建,确保发布前全绿
97 周安装
AI代理任务编排与实施指南:work技能详解,提升开发效率与代码质量
111 周安装
Tailwind CSS v4 完全指南:CSS 优先配置、ESLint 集成与最佳实践
234 周安装
Umbraco Context API 详解:组件通信与数据共享的核心机制
79 周安装
YAML流式解析与AI集成工具 | 渐进式渲染与精准编辑 | @json-render/yaml
149 周安装
AI电影导演技能 - 生成电影级视频的AI智能体工具,支持Veo3/Kling/Luma
144 周安装