Skip to content

Continuous Integration (CI)

Creating a draft, uploading assets, and publishing a release can all also be automated via GitHub Actions.

The action forms a wrapper around the CLI and thus only requires the following inputs:

Workflows

Subsequently you will find example workflows for generic assets, Tauri Applications and projects that utilize cargo-packager.

Generic Workflow

The following workflow will run through the entire release process, so it creates a draft release, uploads assets and finally publishes the release for a to be specified version number, app slug and asset.

For the sake of testing, it is configured to be triggered manually through the workflow_dispatchevent. It will also cancel any previous instances still running.

name: Generic Workflow Release Process
on:
workflow_dispatch:
inputs:
app-slug:
type: string
description: Slug of the application
required: true
app-version:
type: string
description: Version number of the application
required: true
asset-path:
type: string
description: Path for the asset to upload
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CN_APP_SLUG: ${{ github.event.inputs.app-slug }}
CN_APP_VER: ${{ github.event.inputs.app-version }}
CN_ASSET_PATH: ${{ github.event.inputs.asset-path }}
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: draft release
uses: crabnebula-dev/cloud-release@v0.1.0
id: draft
with:
command: release draft ${{ env.CN_APP_SLUG }} ${{ env.CN_APP_VER }}
api-key: ${{ secrets.CN_API_KEY }}
- name: upload assets
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release upload --file ${{ env.CN_ASSET_PATH }} ${{ env.CN_APP_SLUG }} ${{ env.CN_APP_VER }}
api-key: ${{ secrets.CN_API_KEY }}
- name: publish release
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release publish ${{ env.CN_APP_SLUG }} ${{ env.CN_APP_VER }}
api-key: ${{ secrets.CN_API_KEY }}

The most interesting part is in the steps section. After checking out the repo, the crabnebula-dev/cloud-release action is utilized in each step to run through the entire release process once.

Notice how the command input field does not include the cn prefix. The api-key input field of the action should be set using a secret. See Secrets in GitHub Actions for more details on how to set secrets properly.

Tauri Workflow

This workflow is specifically tailored to Tauri applications. It can be easily adapted to work with any Tauri app and only requires the app-slug as an input.

The release version number is automatically extracted from the Tauri configuration files. Instead of just uploading assets (like in the previous workflow), the build job builds the Tauri app automatically for Linux, macOS and Windows and uploads the assets directly afterwards.

TAURI_PRIVATE_KEY and TAURI_KEY_PASSWORD secrets need to be set accordingly. See the Tauri Docs for more details.

name: Tauri Workflow Release Process
on:
workflow_dispatch:
inputs:
app-slug:
type: string
description: Slug of the application
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CN_APP_SLUG: ${{ github.event.inputs.app-slug }}
jobs:
draft:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: create draft release
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release draft ${{ env.CN_APP_SLUG }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
build:
needs: draft
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
- name: install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: Install x86_64-apple-darwin for mac and build Tauri binaries
if: matrix.os == 'macos-latest'
run: |
rustup target add x86_64-apple-darwin
npm ci
npm run tauri build -- --target x86_64-apple-darwin
npm run tauri build -- --target aarch64-apple-darwin
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
- name: build Tauri app for Windows, Linux
if: matrix.os != 'macos-latest'
run: |
npm ci
npm run tauri build
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
- name: upload assets
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release upload ${{ env.CN_APP_SLUG }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}
path: ./src-tauri
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: publish release
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release publish ${{ env.CN_APP_SLUG }} --framework tauri
api-key: ${{ secrets.CN_API_KEY }}

cargo-packager Workflow

The following workflow is specifically tailored to cargo-packager applications.

Only the app-slug needs to be specified as workflow input. Similarly to the Tauri workflow, the release version number is automatically extracted from the Cargo.toml file. The build job builds the packager app automatically for Linux, macOS and Windows and uploads the assets directly afterwards.

name: cargo-packager Workflow Release Process
on:
workflow_dispatch:
inputs:
app-slug:
type: string
description: Slug of the application
required: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CN_APP_SLUG: ${{ github.event.inputs.app-slug }}
jobs:
draft:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: create draft release
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release draft ${{ env.CN_APP_SLUG }} --framework packager
api-key: ${{ secrets.CN_API_KEY }}
build:
needs: draft
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Install stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
- name: install cargo packager
run: |
cargo install cargo-packager --locked
- name: build packager app
run: |
cargo packager --release
- name: Move assets to workdir
run: |
mv target/release/* .
- name: upload assets
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release upload ${{ env.CN_APP_SLUG }} --framework packager
api-key: ${{ secrets.CN_API_KEY }}
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: publish release
uses: crabnebula-dev/cloud-release@v0.1.0
with:
command: release publish ${{ env.CN_APP_SLUG }} --framework packager
api-key: ${{ secrets.CN_API_KEY }}