Skip to content

GitHub Actions

You can easily publish Live Updates to Capawesome Cloud using GitHub Actions. In this guide, we will show you how to create a GitHub Action workflow that builds your web assets and creates a bundle on Capawesome Cloud using the Capawesome CLI.

Preparation

Before you start, make sure you have a Capawesome Cloud account and an app set up. Next, you need to create a Capawesome Token and add it to your GitHub repository as an encrypted secret.

Create a Capawesome Token

Create a new Capawesome token via the Capawesome Cloud Console. Just navigate to the Tokens page in the settings and click on the Create Token button. Choose a name for the token and click on the Create button. The token is now copied to your clipboard.

Create a GitHub Secret

Add the Capawesome Token to your GitHub repository as an encrypted secret with the name CAPAWESOME_TOKEN as described in Creating encrypted secrets for a repository.

Workflow

Create the Workflow

Create a new GitHub Actions workflow file in your repository under .github/workflows/deploy-live-update.yml with the following content:

name: Deploy Live Update

on:
  workflow_dispatch:
    inputs:
      channel:
        description: 'Channel'
        required: true

jobs:
  deploy:
    name: Build web assets
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Node.js 20
        uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Install Dependencies
        run: npm ci
      - name: Build web assets
        run: npm run build
      - name: Login to Capawesome Cloud
        run: npx capawesome login --token ${{ secrets.CAPAWESOME_CLOUD_TOKEN }}
      - name: Create a channel on Capawesome Cloud
        run: npx capawesome apps:channels:create --appId 00000000-0000-0000-0000-000000000000 --name ${{ github.event.inputs.channel }}
        continue-on-error: true
      - name: Create a bundle on Capawesome Cloud
        run: npx capawesome apps:bundles:create --appId 00000000-0000-0000-0000-000000000000 --path dist --channel ${{ github.event.inputs.channel }}

This workflow will build your web assets, log in to Capawesome Cloud, create a channel (if it does not exist yet), and create a bundle for the specified channel.

Trigger the Workflow

You can run the workflow manually by navigating to the Actions tab in your repository and clicking on the Deploy Live Update workflow. You will be prompted to enter the channel name. Of course, you can also trigger the workflow automatically by using a different event trigger like push or pull_request.