Why CrabNebula Cloud? Comparing the Tauri GitHub Action
Tags: tauri, rust, github, githubactions
Published: 2024-03-26 09:58:05

In a prior post, we outlined the difficulty of getting software across [the final mile](https://crabnebula.dev/blog/the-final-mile). As a solution to a number of those challenges, [we built CrabNebula Cloud](https://crabnebula.dev/blog/announcing-crabnebula-cloud/) to help developers distribute their Tauri apps globally and seamlessly. Since we released CrabNebula Cloud, this was the most prominent question from the community.

> *“Why should I use CrabNebula Cloud over the Tauri GitHub Action with GitHub Releases?”*

The TL;DR of it can be found in the following video. For more of a deep dive, continue reading.

{% embed https://youtu.be/HBFFpfJnMvE  %} 

In this post, we’ll answer that question in detail while showing you how you can migrate your workflow with minimal effort in minutes.

## The Tradeoffs

The [Tauri GitHub Action](https://github.com/tauri-apps/tauri-action) is a fantastic tool that allows you to build and distribute your Tauri app via GitHub Releases. It’s a great way to get your app out there, and it’s a great way to get started. However, it has a few limitations that we’ve worked to address with CrabNebula Cloud. Specifically,

1. **Global Distribution**: GitHub Releases are great, but they’re not global. They’re limited to GitHub’s infrastructure, which means that your users in Asia, Africa, and South America will have a suboptimal experience.  
    
    This is because GitHub’s datacenters are primarily located in the United States and Europe. As a result, your users in other parts of the world will have to wait longer to download your app since data on the internet travel distances across the speed of light through fiber-optic cables.  
    
    To help this, CrabNebula Cloud uses a global Content Delivery Network (CDN) to ensure that your app is delivered to your users from their network edges—meaning content servers as geographically close to them as possible. This results in faster downloads and a better user experience.
    
2. **Version Management**: GitHub Releases are secure, but they do not offer fine-grained control over release visibility. This means that if you want to distribute your app to a select group of users, you’ll have to create a new repository or organization to manage access. This repository would then have to contain duplicate code, which can present maintenance problems.  
    
    CrabNebula Cloud logically separates code from releases and even applications. This means that for a single codebase, you can have multiple applications and multiple releases, including nightly/staging build distribution similar to [Chrome Canary](https://www.google.com/chrome/canary/) vs. [Chrome](https://google.com/chrome). This allows you to distribute your app to a select group of users without having to duplicate your code.
    
3. **Analytics**: GitHub Releases do not offer analytics. This means that you won’t be able to see how many people are downloading your app, where they’re downloading it from, or what versions they’re downloading. This can make it difficult to understand your user base and make informed decisions about your app’s future.  
    
    CrabNebula Cloud intends to offer detailed analytics that show you how many people are downloading your app, where they’re downloading it from, and what versions they’re downloading. This can help you understand your user base and make informed decisions about your app’s future.
    
4. **Updates**: GitHub Releases do not offer automatic updates out of the box. This means that if you want to distribute a new version of your app, you’ll have to wrestle through a number of configuration options with the Tauri action and carefully navigate privacy rules for some repositories.  
    
    CrabNebula Cloud has first-class support and an update server built-in that seamlessly integrates with the [Tauri updater](https://tauri.app/v1/guides/distribution/updater). This means that when you distribute a new version of your app, your users will be notified and prompted to update. This can save you time and ensure that your users are always using the latest version of your app.
    
5. **Team Collaboration**: While GitHub is well suited to team collaboration on a codebase level, it is not well suited to team collaboration on a release level.  
    
    CrabNebula Cloud is built for teams, sharing the load of release maintenance and management. CrabNebula Cloud integrates with CrabNebula’s suite of developer tools to unlock higher levels of team collaboration when combined with [DevTools](https://crabnebula.dev/devtools).
    

## Migrating to CrabNebula Cloud

For an existing codebase that is already distributing applications via the Tauri GitHub action and GitHub releases, migrating to CrabNebula Cloud is straightforward. Here’s a step-by-step guide to help you migrate your workflow in minutes.

1. **Sign up for CrabNebula Cloud**: Visit [CrabNebula Cloud](https://crabnebula.dev/cloud) and sign up for an account. Once you’ve signed up, you’ll be able to create a new application and continue with the rest of the setup.
    
2. **Augment your GitHub Workflow**: Instead of using the `tauri-apps/tauri-action`, you’ll want to use the `crabnebula-dev/cloud-release` action and its parameters. This action will upload your Tauri app to CrabNebula Cloud. Here’s an example workflow that you can use as a starting point:
    

```plaintext
name: 'Publish Release'

# This will trigger the action on each push to the `release` branch.
on:
  push:
    branches:
      - release

# We do 3 jobs sequentially,
# 1. Draft a release on CrabNebula Cloud
# 2. (In parallel) Build and upload assets for each OS to the new release
# 3. Publish the release
# You can adjust parameters for each job to suit your needs,
# you can also only create drafts and have publish be a manual step.
jobs:
  # Step 1: Draft a release on CrabNebula Cloud
  draft:
    name: Draft Release
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Create Draft Release (CrabNebula Cloud)
        uses: crabnebula-dev/cloud-release@dev
        id: draft
        with:
          command: release draft ${{ secrets.CN_APP_ID }} --framework tauri
          api-key: ${{ secrets.CN_API_KEY }}

  # Step 2: Build and upload assets for each OS to the new release
  build-and-upload:
    name: Build and Upload Assets
    needs: draft
    permissions:
      contents: write
    strategy:
      fail-fast: false
      # This will create a job for each platform in the matrix
      matrix:
        include:
          - platform: macos-latest
            target: aarch64-apple-darwin
          - platform: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          - platform: windows-latest
            target: x86_64-pc-windows-msvc

    runs-on: ${{ matrix.platform }}
    steps:
      - uses: actions/checkout@v4

      - name: setup node
        uses: actions/setup-node@v4
        with:
          node-version: 20

      - uses: Swatinem/rust-cache@v2

      - name: Install Dependencies (Ubuntu only)
        if: runner.os == 'Linux'
        run: |
          sudo apt-get update
          sudo apt-get install -y pkg-config libssl-dev libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf

      - name: Install Front-end Dependencies
        run: npm install

      - name: Install Rust target
        run: rustup target add ${{ matrix.target }}

      - name: Build Tauri App
        run: npm run tauri build -- -vv --target ${{ matrix.target }}

      - name: Upload Build Artifacts (CrabNebula Cloud)
        uses: crabnebula-dev/cloud-release@dev
        id: upload
        with:
          command: release upload ${{ secrets.CN_APP_ID }} --framework tauri
          api-key: ${{ secrets.CN_API_KEY }}

  # Step 3: Publish the release
  publish:
    name: Publish Release to CrabNebula Cloud
    needs: build-and-upload
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: crabnebula-dev/cloud-release@dev
        id: publish
        with:
          command: release publish ${{ secrets.CN_APP_ID }} --framework tauri
          api-key: ${{ secrets.CN_API_KEY }}
```

This workflow will create a draft release on CrabNebula Cloud, build and upload assets for each OS to the new release, and then publish the release. You can adjust parameters for each job to suit your needs, and you can also only create drafts and have publish be a manual step.

It’s worth noting that you will need 2 repo-level secrets to use this action:

* `CN_APP_ID` and
    
* `CN_API_KEY`
    

You can find these values in your CrabNebula Cloud account settings, and learn more about them in the [Cloud documentation](https://docs.crabnebula.dev/cloud/#create-an-api-key).

Once you’ve got this workflow up and running, you’ll be able to distribute your Tauri app via CrabNebula Cloud and opt-in to the benefits we’ve outlined above while maintaining a similar workflow to what you’re already used to.

A full [reference pull request](https://github.com/tejas-crabnebula/tauri-cn-github-action/pull/1/files) is available as well if you’d like to explore a diff moving from the Tauri GitHub Action to CrabNebula Cloud to enjoy these benefits.

## We’re Here to Help

The developer relations team at CrabNebula is here to help you migrate your workflow to CrabNebula Cloud. If you have any questions or need assistance, please don’t hesitate to reach out to us on [𝕏](https://twitter.com/CrabNebulaDev) or [Discord](https://discord.gg/XmMNuumsJb) and we’ll be sure to show up and pair program, discuss, or support you and your team however we can.

Happy building!

---

*Author:* ***Tejas Kumar, Director of Developer Relations @crabnebuladev***