article illustration Capgo Integration with GitHub Actions: Guide
Development, Mobile, Updates
Last update: March 18, 2025

Capgo Integration with GitHub Actions: Guide

Integrate Capgo with GitHub Actions for efficient, secure, and cost-effective app updates, enhancing your development workflow.

Capgo and GitHub Actions together simplify deploying updates for Capacitor apps. Here’s why this integration is worth your attention:

  • Save Money: Cut CI/CD costs by up to $26,100 over 5 years compared to AppFlow.
  • Fast Updates: Push updates instantly with 95% of users receiving them in 24 hours.
  • Secure Deployments: End-to-end encryption ensures updates are safe.
  • Streamlined Workflow: Automate builds and deployments directly in your GitHub repository.

Quick Overview

  1. Requirements: GitHub account, Capgo account (from $12/month), Capacitor project, Node.js.
  2. Setup: Install Capgo CLI with npx @capgo/cli init, configure GitHub Actions with a YAML workflow.
  3. Deployment: Use commands like npx @capgo/cli deploy to automate updates.
  4. Testing: Deploy to test channels (e.g., beta, staging) before production.

Example Workflow (YAML):

name: Capgo Deploy
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install Dependencies
run: npm install
- name: Deploy to Capgo
run: npx @capgo/cli deploy
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

This integration ensures fast, secure, and cost-effective app updates, making it ideal for agile development teams.

GitHub Actions Tutorial - Basic Concepts and CI/CD Pipeline

GitHub Actions

Setup Requirements

Integrating Capgo with GitHub Actions involves setting up the necessary tools and configurations.

Required Tools and Accounts

Make sure you have the following accounts and tools ready:

RequirementPurposeDetails
GitHub AccountVersion Control & CI/CDActive account with access to repositories
Capgo AccountManage Live UpdatesPlans start at $12/month for the SOLO plan
Capacitor ProjectApp DevelopmentA functional project ready for integration
Node.jsRuntime EnvironmentLatest LTS version is recommended

Once these are in place, you can proceed to add Capgo to your project for automated live updates.

Adding Capgo to Your Project

Capgo

To integrate Capgo, install it in your Capacitor project using its CLI tool. According to Martin Donadieu, founder of Capgo:

“Run npx @capgo/cli init that it!” [1]

This command will set up the plugin and its required dependencies.

GitHub Repository Setup

Prepare your GitHub repository to meet the requirements for CI/CD integration with Capgo. As mentioned in their documentation:

“We configure your CI/CD pipeline directly in your preferred platform, whether it’s GitHub Actions, GitLab CI, or others. We don’t host CI/CD or charge you to maintain it.” [1]

Capgo offers this setup for a one-time fee of $2,600 and ~$300/month, which is more affordable compared to AppFlow’s $6,000 annual fee [1].

Here’s how to set up your repository:

  • Repository Structure: Organize your repository with separate directories for source code, assets, and configuration files to keep everything clean and manageable.
  • Environment Configuration: Create distinct environments for development, staging, and production, ensuring proper access controls and security measures are in place.
  • Access Management: Set repository permissions carefully to allow Capgo integration while maintaining security.

These steps will ensure your project is ready for the GitHub Actions workflow, which will be outlined in the next section.

GitHub Actions Workflow Setup

Automate your Capgo deployments using GitHub Actions to streamline your CI/CD process.

Creating the Workflow File

Start by creating a YAML file in the .github/workflows directory of your repository. Here’s an example:

name: Capgo Deploy
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Install Dependencies
run: npm install
- name: Build App
run: npm run build
- name: Deploy to Capgo
run: npx @capgo/cli deploy
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

This configuration ensures secure and automated deployments. Once you’ve set up the file, choose the right triggers for your workflow.

Workflow Trigger Options

GitHub Actions allows you to customize when workflows run. Here are some trigger options:

Trigger TypeUse CaseConfiguration
Push EventsDeploy on code changesActivates when code is pushed to specific branches
Manual DispatchOn-demand updatesAllows you to manually start the workflow
ScheduleTimed releasesRuns deployments at set intervals
Pull RequestTesting updatesTests changes before merging into main branches

Managing Secret Keys

To ensure secure deployments, you need to manage your secret keys properly. GitHub Actions offers an encrypted secrets management system for this purpose.

Steps to Set Up Secure Authentication:

  1. Access Repository Settings
    Go to your repository’s settings and find the “Secrets and variables” section under the “Security” tab.

  2. Add Capgo Credentials
    Save your Capgo authentication token as a repository secret. Name it CAPGO_TOKEN.

  3. Reference Secrets in Workflows
    Use your stored secrets in the workflow by referencing them like this: ${{ secrets.CAPGO_TOKEN }}.

Capgo Commands in Workflows

Once your GitHub Actions environment is set up, you can automate deployments by integrating Capgo CLI commands.

Installing Capgo CLI

Add the following step to your workflow to install the Capgo CLI:

steps:
- name: Install Capgo CLI
run: npm install -g @capgo/cli
- name: Initialize Capgo
run: npx @capgo/cli init

Authenticating the CLI

Securely authenticate the CLI using the CAPGO_TOKEN:

- name: Authenticate Capgo CLI
run: npx @capgo/cli login
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

Deployment Commands

Here are the key commands to handle building, versioning, and deploying your updates:

CommandPurposeUsage Example
buildGenerates a production-ready bundlenpx @capgo/cli build
deployPushes updates to Capgonpx @capgo/cli deploy
versionSets the version for the updatenpx @capgo/cli version 1.2.0

To automate the entire deployment process, use the commands together like this:

steps:
- name: Build and Deploy
run: |
npx @capgo/cli build
npx @capgo/cli version ${{ github.ref_name }}
npx @capgo/cli deploy
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

This setup ensures that your updates are automatically built, versioned, and deployed whenever the workflow runs. GitHub’s secret management system keeps your credentials safe throughout the process.

Testing and Fixes

Running Test Workflows

You can test your GitHub Actions workflow by using a dedicated Capgo testing channel. This allows you to validate updates before they go live.

- name: Test Build Deployment
run: |
npx @capgo/cli build
npx @capgo/cli deploy --channel beta
env:
CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }}

Capgo’s channel system helps you create separate deployment paths for different stages:

ChannelPurposeTarget Audience
betaPre-release testingInternal team
stagingQA validationTest users
productionLive deploymentAll users

Error Solutions

Here are some common integration issues and how to address them:

1. Authentication Failures

Check the CAPGO_TOKEN in GitHub Secrets. If it’s expired, regenerate it to ensure smooth authentication.

2. Build Errors

Ensure your build configuration matches the requirements of your deployment environment.

“We rolled out Capgo OTA updates in production for our user base of +5000. We’re seeing very smooth operation almost all our users are upto date within minutes of the OTA being deployed to @Capgo.” [1]

3. Version Conflicts

Stick to semantic versioning and increment versions properly to prevent conflicts during deployments.

Maintenance Tips

  • Use Capgo analytics to monitor update success rates.
  • Enable automatic rollbacks for updates that might cause issues.
  • Test pull requests (PRs) using channel selectors for better control.
  • Keep your workflow updated with the latest Capgo CLI commands.

For high-priority deployments, take advantage of Capgo’s error tracking to spot potential issues early. If something goes wrong, the rollback feature allows you to revert to a stable version quickly, minimizing disruption. These practices will help keep your deployments running smoothly as you move closer to production.

Conclusion

Key Highlights

Capgo’s integration with GitHub Actions simplifies the deployment process for Capacitor apps, delivering major benefits to development teams. With an 82% global success rate for updates and 95% of active users receiving updates within 24 hours [1], this solution stands out for its efficiency.

Here are some standout features:

  • Automated Workflows: By configuring workflows directly in GitHub Actions, there’s no need for external CI/CD hosting. This approach cuts operational costs, saving about $26,100 over five years compared to alternatives like AppFlow [1].
  • Fast Deployment: Updates can be pushed instantly, bypassing app store delays.
  • Strong Security: End-to-end encryption ensures updates are delivered securely, while Capgo’s channel system allows for controlled, staged rollouts.

These features pave the way for more tailored solutions and improved performance, explored further below.

Advanced Strategies

To get the most out of your Capgo and GitHub Actions integration, explore these advanced tactics:

  • Custom API Workflows: Use Capgo’s public API to design deployment workflows that fit your team’s specific needs. This can enable white-label experiences and seamless integration with your current tools [1].
  • Channel-Based Releases: Optimize your deployment process by using Capgo’s channel features for staged and controlled updates.
  • Optimized Performance: Utilize Capgo’s partial updates to reduce bandwidth usage and speed up updates. With 23.5 million updates delivered across 750 production apps [1], the system has proven its capability to handle large-scale demands.

For even better results, consider using Capgo’s self-hosting options or custom API setups. Check earlier sections for detailed setup and testing instructions to fully implement these strategies.

Authored By

Instant Updates for CapacitorJS Apps

Push updates, fixes, and features instantly to your CapacitorJS apps without app store delays. Experience seamless integration, end-to-end encryption, and real-time updates with Capgo.

Get Started Now

Latest from news

Capgo gives you the best insights you need to create a truly professional mobile app.

blog illustration 5 Security Best Practices for Mobile App Live Updates
Development, Mobile, Updates
January 14, 2025

5 Security Best Practices for Mobile App Live Updates

Read more
blog illustration 5 Steps to Deploy Hotfixes with Capgo
Development, Mobile, Updates
March 13, 2025

5 Steps to Deploy Hotfixes with Capgo

Read more