Skip to content

Open Source Tauri Application GitHub Actions Automated Deployment and Upgrade Guide

1. Introduction

This article details how to use GitHub Actions to implement automated building, publishing, and automatic application update functionality for Tauri applications through UpgradeLink. Through this guide, you will learn how to configure GitHub Actions workflows to complete the fully automated process from code submission to application updates.

2. Core Tools Introduction

1. Official Tauri GitHub Action

The official GitHub Action plugin provided by Tauri helps developers automatically build, package, and publish Tauri applications to GitHub Releases in the GitHub Actions environment.

The Action plugin provided by UpgradeLink is used to upload the update file (latest.json) generated by the Tauri application to the UpgradeLink server. UpgradeLink reads the application file address in the json file, saves the file, automatically creates application version files, and creates corresponding upgrade strategies.

3. Example Project with Complete Workflow

Example project with complete workflow

3. Workflow Description

The workflow consists of two main jobs:

  1. publish-tauri: Build and publish Tauri application to GitHub Releases

    • Cross-platform build: Supports macOS, Linux, and Windows simultaneously
    • Version number extraction: Extract application version number from Tauri build output
    • Release management: Automatically create GitHub Release and upload application installation packages
  2. upgradeLink-upload: Sync update information to UpgradeLink

    • Dependencies: Wait for publish-tauri job to complete
    • Version awareness: Get application version number through output parameters
    • API call: Use UpgradeLink Action to upload latest.json to upgrade server

4. Detailed Integration Steps

1. Preparation

First, ensure the following:

  • GitHub repository has been created and Tauri application code has been uploaded
  • You have an UpgradeLink platform account and obtained the following credentials:
  • In the UpgradeLink platform's tauri application configuration, configure the GitHub repository address.

2. Configure GitHub Secrets

Add the following encrypted environment variables in GitHub repository's Settings > Security > Secrets and variables > Actions:

Secret NameDescription
UPGRADE_LINK_ACCESS_KEYAccess key provided by UpgradeLink platform for API call authentication
UPGRADE_LINK_ACCESS_SECRETAccess secret provided by UpgradeLink platform for API call authentication
UPGRADE_LINK_TAURI_KEYUnique identifier assigned by UpgradeLink platform for your Tauri application
TAURI_SIGNING_PRIVATE_KEYTauri application signing private key (if code signing is needed)
TAURI_SIGNING_PRIVATE_KEY_PASSWORDSigning private key password (if set)

Because using the tauri-action workflow may encounter various permission issues, you need to run through the process in advance.

4. Modify the default configuration information provided by the official

Official Example Workflow

Make the following modifications based on the official example:

name: 'publish'

on:
  push:
    branches:
      - main

jobs:
  publish-tauri:
    permissions:
      contents: write
    outputs:
      appVersion: ${{ steps.set-job-output.outputs.appVersion }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - platform: 'macos-latest' # for Arm based macs (M1 and above).
            args: '--target aarch64-apple-darwin'
          - platform: 'macos-latest' # for Intel based macs.
            args: '--target x86_64-apple-darwin'
          - platform: 'ubuntu-22.04'
            args: ''
          - platform: 'ubuntu-22.04-arm' # Only available in public repos.
            args: ''
          - platform: 'windows-latest'
            args: ''

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

      - name: install dependencies (ubuntu only)
        if: startsWith(matrix.platform, 'ubuntu-') # This must match the platform value defined above.
        run: |
          sudo apt-get update
          sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils

      - name: setup node
        uses: actions/setup-node@v4
        with:
          node-version: lts/*
          cache: 'yarn' # Set this to npm, yarn or pnpm.

      - name: install Rust stable
        uses: dtolnay/rust-toolchain@stable # Set this to dtolnay/rust-toolchain@nightly
        with:
          # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
          targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

      - name: Rust cache
        uses: swatinem/rust-cache@v2
        with:
          workspaces: './src-tauri -> target'

      - name: install frontend dependencies
        # If you don't have `beforeBuildCommand` configured you may want to build your frontend here too.
        run: yarn install # change this to npm or pnpm depending on which one you use.

      - uses: tauri-apps/tauri-action@v0
        id: tauri-action  # Add id for later reference
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
          TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
        with:
          tagName: tauri-demo-v__VERSION__
          releaseName: 'tauri-demo v__VERSION__'
          releaseBody: 'See the assets to download this version and install.'
          releaseDraft: false # Do not create draft version
          prerelease: false # Not as pre-release version
          args: ${{ matrix.args }}

      - name: Set job output
        id: set-job-output
        if: matrix.platform == 'ubuntu-22.04'
        run: |
          echo "appVersion=${{ steps.tauri-action.outputs.appVersion }}" >> $GITHUB_OUTPUT
          

  upgradeLink-upload:
      needs:  publish-tauri  # Depends on publish-tauri job completion
      permissions:
        contents: write
      runs-on: ubuntu-latest
      steps:
        - name: Send a request to UpgradeLink
          uses: toolsetlink/upgradelink-action@3.0.2
          with:
            access_key: ${{ secrets.UPGRADE_LINK_ACCESS_KEY }}
            access_secret: ${{ secrets.UPGRADE_LINK_ACCESS_SECRET }}
            config: |
              {
                "app_type": "tauri",
                "request": {
                  "app_key": "${{ secrets.UPGRADE_LINK_TAURI_KEY }}",
                  "latest_json_url": "https://github.com/toolsetlink/tauri-demo/releases/download/tauri-demo-v${{ needs.publish-tauri.outputs.appVersion }}/latest.json"
                }
              }

5. Common Issues and Solutions

1. GitHub Actions Permission Issues

If you encounter insufficient permission errors, ensure:

  • permissions: contents: write is configured in the workflow file
  • Actions permissions are correctly configured in repository settings

2. Build Failure Troubleshooting

  • Check GitHub Actions logs for specific error information
  • Confirm all dependencies are correctly installed, especially system dependencies for Linux platform
  • Ensure Rust and Node.js versions are compatible
  • Check if the application identifier in the UpgradeLink console matches the configuration
  • Confirm if the correct latest.json file is generated in GitHub Releases

6. Summary

With the above configuration, you can implement a fully automated build, publish, and update process for Tauri applications. Whenever code is pushed to the specified branch, GitHub Actions will automatically complete the following tasks:

  1. Detect code changes
  2. Build Tauri application in multi-platform environments
  3. Create GitHub Release and upload installation packages
  4. Extract application version number
  5. Sync update information to UpgradeLink platform
  6. End users will receive application update notifications through UpgradeLink

This automated process greatly improves development efficiency, reduces manual operation errors, and allows developers to focus more on application feature development.

toolsetlink@163.com