AlexVeeBee's Wiki

App Updater

GitLab Releases & Tauri v2 Auto-Updater

This document explains how Prompt Builder builds, signs, and publishes desktop installers to GitLab Releases, and how the Tauri v2 app automatically checks for and installs updates.


Architecture Overview

  1. Tag Push (vX.Y.Z) triggers the GitLab CI/CD pipeline.
  2. Build Jobs (build_linux and build_windows_exe) compile the Nuxt frontend and Tauri Rust binary, signing the updater bundles (.AppImage and NSIS .exe) using TAURI_SIGNING_PRIVATE_KEY to produce .sig signature files.
  3. Publish Job (publish):
    • Verifies that the Git tag matches version in package.json and src-tauri/tauri.conf.json.
    • Uploads installers to the GitLab Generic Package Registry.
    • Generates latest.json containing the version, release date, download URLs, and raw .sig contents for linux-x86_64 and windows-x86_64.
    • Uploads latest.json and creates a GitLab Release with filepath: "/latest.json".
  4. In-App Updater queries GitLab's permanent latest-release asset URL on startup:
    https://gitlab.example.com/example/repo/-/releases/permalink/latest/downloads/latest.json
    

1. Signing Keys & GitLab CI/CD Variables

Tauri v2 requires cryptographic signatures on all update bundles.

Generating Keys (One-Time)

pnpm tauri signer generate -w ~/.tauri/prompt-builder.key

If you lose the private key, existing installations will not be able to verify future updates.

GitLab CI/CD Variable Configuration

Add the following under Settings → CI/CD → Variables:

Key Type Visibility Protect variable Expand variable reference Value
TAURI_SIGNING_PRIVATE_KEY Variable Masked and hidden Optional* Unchecked Single-line contents of prompt-builder.key (no trailing newline)
TAURI_SIGNING_PRIVATE_KEY_PASSWORD Variable Masked and hidden Optional* Unchecked Key password (only if set during generation)

Protected Variables & Tags: If Protect variable is checked, you must also protect release tags (e.g., v*) under Settings → Repository → Protected tags. Otherwise, tag pipelines will not receive the signing key and the publish job will fail.


2. Tauri Configuration

Plugins & Capabilities

src-tauri/tauri.conf.json

{
  "bundle": {
    "active": true,
    "targets": "all",
    "createUpdaterArtifacts": true
  },
  "plugins": {
    "updater": {
      "requireSignedVersion": true,
      "pubkey": "<PUBLIC_KEY_FROM_KEY_PUB>",
      "endpoints": [
        "https://gitlab.example.com/example/repo/-/releases/permalink/latest/downloads/latest.json"
      ],
      "windows": {
        "installMode": "passive"
      }
    }
  }
}

3. Frontend Update Check

Update checks run on startup in app/app.vue via checkForAppUpdates() in app/lib/updater.ts:

import { check } from '@tauri-apps/plugin-updater';
import { relaunch } from '@tauri-apps/plugin-process';
import { confirmDialog, DialogCancelledError } from './dialog';

export async function checkForAppUpdates(): Promise<void> {
    if (typeof window === 'undefined' || !('__TAURI_INTERNALS__' in window)) {
        return;
    }

    try {
        const update = await check();
        if (!update) return;

        await confirmDialog({
            title: `Update available (v${update.version})`,
            message: update.body
                ? `${update.body}\n\nDownload and install now?`
                : `Version ${update.version} is available. Download and install now?`,
            confirmLabel: 'Update & Restart',
            cancelLabel: 'Later',
        });

        await update.downloadAndInstall();
        await relaunch();
    } catch (error) {
        if (error instanceof DialogCancelledError) {
            return;
        }
        console.debug('Updater check skipped:', error);
    }
}

On Windows, the NSIS installer automatically exits the application during downloadAndInstall(). On Linux, relaunch() restarts the updated AppImage.


4. GitLab CI/CD Pipeline (.gitlab-ci.yml)

Build Artifacts

publish Job & latest.json

The publish job runs only on tags matching /^v\d+\.\d+\.\d+([-.].+)?$/:

  1. Validates CI_COMMIT_TAG (without v) equals version in package.json and src-tauri/tauri.conf.json.
  2. Uploads installers to ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${PACKAGE_NAME}/${TAG_VERSION}/....
  3. Builds latest.json:
    {
      "version": "0.2.0",
      "notes": "Release v0.2.0",
      "pub_date": "2026-11-29T16:35:00.000Z",
      "platforms": {
        "linux-x86_64": {
          "signature": "<contents of .AppImage.sig>",
          "url": "<Generic Package URL for .AppImage>"
        },
        "windows-x86_64": {
          "signature": "<contents of .exe.sig>",
          "url": "<Generic Package URL for .exe>"
        }
      }
    }
    
  4. Uploads latest.json and attaches it to the GitLab Release with "filepath": "/latest.json" so /-/releases/permalink/latest/downloads/latest.json always resolves to the latest release.

Private Repositories: Anonymous GET requests to /-/releases/permalink/latest/downloads/latest.json and Generic Package URLs require the project (or its Releases) to be publicly accessible. For private projects, pass a read-only token header in check({ headers: { ... } }).


5. How to Publish a New Release

  1. Update "version" to the new SemVer (e.g., 0.2.1) in:
    • package.json
    • src-tauri/tauri.conf.json
    • src-tauri/Cargo.toml
  2. Commit the version bump:
    git add package.json src-tauri/tauri.conf.json src-tauri/Cargo.toml
    git commit -m "chore: bump version to 0.2.1"
    
  3. Create and push the matching tag:
    git tag v0.2.1
    git push origin main v0.2.1
    
  4. Monitor the pipeline in GitLab (Build → Pipelines) and verify the new release appears under Deploy → Releases with latest.json and all installers attached.