feat(release): ship a Linux .deb that updates itself (#13575)

The Linux release build now also makes a .deb in the same electron-builder
run as the AppImage, and the release publishes it. electron-builder lists it
in latest-linux.yml and writes resources/package-type into it, so the app
updates a .deb install through electron-updater, which installs the new .deb
with dpkg. The desktop updater now allows that path.

The .deb uses xz in threaded mode (XZ_DEFAULTS=-T0): 113 MB in place of
141 MB with gzip. The Linux arm64 release job moves to a 16-vCPU Blacksmith
arm64 runner. The download page, README, install guide, and release docs
list the .deb.

Based on community work in #4071, #5139, #4900, and #4887.

Co-authored-by: chukfinley <[email protected]>
Co-authored-by: Primož Ajdišek <[email protected]>
Co-authored-by: benthecarman <[email protected]>
Co-authored-by: NaveDanan <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-09-24 23:08:35 -07:00
1 parent 20f0ff1781
commit c13f7d93ff
11 files changed
+124 -13

No files matched your search

+1
View File
@@ -510,6 +510,7 @@ jobs:
"release/*.dmg"
"release/*.zip"
"release/*.AppImage"
"release/*.deb"
"release/*.exe"
)
# Preview builds have no publish config, so electron-builder writes
+2 -1
View File
@@ -625,7 +625,7 @@ jobs:
clerk_cli_oauth_client_id: ${{ needs.relay_public_config.outputs.clerk_cli_oauth_client_id }}
relay_url: ${{ needs.relay_public_config.outputs.relay_url }}
label: Linux arm64
runner: ubuntu-24.04-arm
runner: blacksmith-16vcpu-ubuntu-2404-arm
platform: linux
target: AppImage
arch: arm64
@@ -875,6 +875,7 @@ jobs:
echo 'release-assets/*.dmg'
echo 'release-assets/*.zip'
echo 'release-assets/*.AppImage'
echo 'release-assets/*.deb'
echo 'release-assets/*.exe'
if [[ "${{ needs.preflight.outputs.release_channel }}" != "preview" ]]; then
echo 'release-assets/*.blockmap'
+8
View File
@@ -54,6 +54,14 @@ winget install T3Tools.T3Code
brew install --cask t3-code
```
#### Debian, Ubuntu (`.deb`)
Download the `.deb` from [GitHub Releases](https://github.com/pingdotgg/t3code/releases), then:
```bash
sudo apt install ./T3-Code-*.deb
```
#### Arch Linux (AUR)
Stable:
@@ -87,6 +87,25 @@ describe("DesktopUpdates", () => {
}).pipe(Effect.provide(Layer.merge(TestClock.layer(), harness.layer)));
});
it.effect("updates Linux .deb installs and leaves other non-AppImage installs off", () =>
Effect.gen(function* () {
const linuxState = (packageType: string | undefined) =>
Effect.scoped(
Effect.gen(function* () {
const updates = yield* DesktopUpdates.DesktopUpdates;
yield* updates.configure;
return yield* updates.getState;
}),
).pipe(Effect.provide(makeHarness({ platform: "linux", packageType }).layer));
const deb = yield* linuxState("deb\n");
assert.equal(deb.status, "idle");
const unmarked = yield* linuxState(undefined);
assert.equal(unmarked.status, "disabled");
}),
);
it.effect("subscribe delivers the latest state plus subsequent changes", () => {
const harness = makeHarness();
+16 -2
View File
@@ -250,6 +250,7 @@ function getAutoUpdateDisabledReason(args: {
isPackaged: boolean;
platform: NodeJS.Platform;
appImage?: string | undefined;
isDebPackage: boolean;
disabledByEnv: boolean;
hasUpdateFeedConfig: boolean;
}): string | null {
@@ -262,8 +263,8 @@ function getAutoUpdateDisabledReason(args: {
if (args.disabledByEnv) {
return "Automatic updates are disabled by the T3CODE_DISABLE_AUTO_UPDATE setting.";
}
if (args.platform === "linux" && !args.appImage) {
return "Automatic updates on Linux require running the AppImage build.";
if (args.platform === "linux" && !args.appImage && !args.isDebPackage) {
return "Automatic updates on Linux require the AppImage or the .deb package.";
}
return null;
}
@@ -332,6 +333,18 @@ export const make = Effect.gen(function* () {
),
);
// The .deb carries electron-builder's resources/package-type marker.
// electron-updater reads the same file and installs updates with dpkg.
const isDebPackage =
environment.platform === "linux" && environment.isPackaged
? yield* fileSystem
.readFileString(environment.path.join(environment.resourcesPath, "package-type"))
.pipe(
Effect.map((packageType) => packageType.trim() === "deb"),
Effect.orElseSucceed(() => false),
)
: false;
const hasUpdateFeedConfig = Ref.get(appUpdateYmlConfigRef).pipe(
Effect.map((appUpdateYmlConfig) => Option.isSome(appUpdateYmlConfig) || config.mockUpdates),
);
@@ -344,6 +357,7 @@ export const make = Effect.gen(function* () {
isPackaged: environment.isPackaged,
platform: environment.platform,
appImage: Option.getOrUndefined(config.appImagePath),
isDebPackage,
disabledByEnv: config.disableAutoUpdate,
hasUpdateFeedConfig: hasFeedConfig,
}),
+16 -1
View File
@@ -2,6 +2,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
import type { DesktopUpdateState } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as PlatformError from "effect/PlatformError";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
@@ -33,6 +34,9 @@ export interface UpdatesHarnessOptions {
readonly stopBackend?: Effect.Effect<void>;
readonly startBackend?: Effect.Effect<void>;
readonly env?: Record<string, string | undefined>;
readonly platform?: NodeJS.Platform;
/** Contents of the resources/package-type marker a Linux package ships. */
readonly packageType?: string | undefined;
}
export function makeHarness(options: UpdatesHarnessOptions = {}) {
@@ -146,7 +150,7 @@ export function makeHarness(options: UpdatesHarnessOptions = {}) {
const environmentLayer = DesktopEnvironment.layer({
dirname: "/repo/apps/desktop/src",
homeDirectory: `/tmp/t3-desktop-updates-home-${process.pid}`,
platform: "darwin",
platform: options.platform ?? "darwin",
processArch: "x64",
appVersion: "1.2.3",
appPath: "/repo",
@@ -208,6 +212,17 @@ export function makeHarness(options: UpdatesHarnessOptions = {}) {
// disk I/O that would outrun the tests' settle loops.
const updateRestartMarkers = new Set<string>();
const fileSystemLayer = FileSystem.layerNoop({
readFileString: (path) =>
path === "/missing/resources/package-type" && options.packageType !== undefined
? Effect.succeed(options.packageType)
: Effect.fail(
PlatformError.systemError({
module: "FileSystem",
method: "readFileString",
_tag: "NotFound",
pathOrDescriptor: path,
}),
),
makeDirectory: () => Effect.void,
writeFileString: (path) =>
Effect.sync(() => {
+14
View File
@@ -91,6 +91,16 @@ const imageProps = {
<h2 class="platform-name">Linux</h2>
</div>
<div class="download-cards">
<a class="download-card" data-asset="amd64.deb" href={RELEASES_URL}>
<span class="card-icon">
<Image class="card-icon--stable" src={iconStable} width={28} height={28} loading="lazy" {...imageProps} />
<Image class="card-icon--nightly" src={iconNightly} width={28} height={28} loading="lazy" {...imageProps} />
</span>
<span class="card-text">
<span class="card-arch">Debian, Ubuntu</span>
<span class="card-format">.deb</span>
</span>
</a>
<a class="download-card" data-asset="x86_64.AppImage" href={RELEASES_URL}>
<span class="card-icon">
<Image class="card-icon--stable" src={iconStable} width={28} height={28} loading="lazy" {...imageProps} />
@@ -102,6 +112,10 @@ const imageProps = {
</span>
</a>
</div>
<p class="intel-note">
On ARM? Download the arm64 <a data-asset="arm64.deb" href={RELEASES_URL}>.deb</a> or
<a data-asset="arm64.AppImage" href={RELEASES_URL}>AppImage</a>.
</p>
</section>
<!-- Mobile. Stable only, there is no nightly mobile build. -->
+2 -2
View File
@@ -29,7 +29,7 @@ This document covers the unified release workflow for stable and nightly desktop
- Builds six desktop artifacts in parallel for both channels, each as its own job (`desktop_<platform>_<arch>`, one call of `release-desktop.yml`) on hardware of its own architecture, gated only on the bundle (the Windows jobs also wait for the same-arch Linux job, whose CLI archive they embed as the WSL runtime):
- macOS `arm64` DMG
- macOS `x64` DMG
- Linux `x64` and `arm64` AppImage
- Linux `x64` and `arm64` AppImage and `.deb`, from one electron-builder run. The `.deb` updates in the app through electron-updater, which installs it with `dpkg`.
- Windows `x64` and `arm64` NSIS installer
- Publishes one GitHub Release with all produced files.
- Stable tags with a suffix after `X.Y.Z` (for example `1.2.3-alpha.1`) are published as GitHub prereleases.
@@ -329,7 +329,7 @@ available.
- `T3CODE_DESKTOP_UPDATE_REPOSITORY` (format `owner/repo`), if set.
- otherwise `GITHUB_REPOSITORY` from GitHub Actions.
- Required release assets for updater:
- platform installers (`.exe`, `.dmg`, `.AppImage`, plus macOS `.zip` for Squirrel.Mac update payloads)
- platform installers (`.exe`, `.dmg`, `.AppImage`, `.deb`, plus macOS `.zip` for Squirrel.Mac update payloads)
- channel metadata: `latest*.yml` for stable releases, `nightly*.yml` for nightly releases
- `*.blockmap` files (used for differential downloads)
- macOS metadata note:
+11 -6
View File
@@ -58,12 +58,17 @@ update it with `git pull` and a rebuild.
Download a release from [GitHub Releases](https://github.com/pingdotgg/t3code/releases),
or use a package manager:
| Platform | Install |
| ------------------ | ------------------------------- |
| Windows | `winget install T3Tools.T3Code` |
| macOS | `brew install --cask t3-code` |
| Arch Linux | `yay -S t3code-bin` |
| Arch Linux nightly | `yay -S t3code-nightly-bin` |
| Platform | Install |
| ------------------ | ---------------------------------- |
| Windows | `winget install T3Tools.T3Code` |
| macOS | `brew install --cask t3-code` |
| Debian, Ubuntu | `sudo apt install ./T3-Code-*.deb` |
| Arch Linux | `yay -S t3code-bin` |
| Arch Linux nightly | `yay -S t3code-nightly-bin` |
The `.deb` updates itself like the other desktop builds. It asks for your
password to install each update. If your desktop has no password prompt, the
update fails. Download the new `.deb` and install it the same way.
### Windows Subsystem for Linux
+2
View File
@@ -668,6 +668,8 @@ it.layer(NodeServices.layer)("build-desktop-artifact", (it) => {
iconSize: 120,
iconTextSize: 12,
});
// A Linux AppImage build also emits the .deb from the same run.
assert.deepStrictEqual((linux.linux as Record<string, unknown>).target, ["AppImage", "deb"]);
// Linux must register the renderer schemes so the generated .desktop
// entry advertises MimeType=x-scheme-handler/t3code; for OAuth deep links.
assert.deepStrictEqual((linux.linux as Record<string, unknown>).protocols, [
+33 -1
View File
@@ -929,6 +929,7 @@ interface StagePackageJson {
readonly private: true;
readonly packageManager: string;
readonly description: string;
readonly homepage: string;
readonly author: string;
readonly main: string;
readonly build: Record<string, unknown>;
@@ -2733,10 +2734,17 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
if (platform === "linux") {
buildConfig.linux = {
target: [target],
// The .deb is built from the same unpacked app after the AppImage.
// electron-builder lists both in latest-linux.yml and writes
// resources/package-type into the .deb only, so electron-updater updates
// each install in its own format.
target: target === "AppImage" ? [target, "deb"] : [target],
executableName: "t3code",
icon: "icons",
category: "Development",
synopsis: "Desktop GUI for coding agents",
// Required by the .deb control file.
maintainer: "T3 Tools <[email protected]>",
// electron-builder turns these into MimeType=x-scheme-handler/<scheme>;
// in the .desktop entry (Exec already gets %U), so browsers can hand
// t3code:// OAuth callbacks to the app.
@@ -2752,6 +2760,23 @@ export const createBuildConfig = Effect.fn("createBuildConfig")(function* (
},
},
};
buildConfig.deb = {
// Electron's runtime libraries. Debian 13 and Ubuntu 24.04 renamed some
// for 64-bit time; the old name is the fallback for older releases.
depends: [
"libasound2t64 | libasound2",
"libatspi2.0-0t64 | libatspi2.0-0",
"libgbm1",
"libgtk-3-0t64 | libgtk-3-0",
"libnotify4",
"libnss3",
"libsecret-1-0",
"libuuid1",
"libxss1",
"libxtst6",
"xdg-utils",
],
};
}
if (platform === "win") {
@@ -3642,6 +3667,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
private: true,
packageManager: rootPackageJson.packageManager,
description: "T3 Code desktop build",
// Required by the .deb control file.
homepage: "https://t3.codes",
author: "T3 Tools",
main: "apps/desktop/dist-electron/main.cjs",
build: yield* createBuildConfig(
@@ -3738,6 +3765,11 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
delete buildEnv[key];
}
}
if (options.platform === "linux") {
// fpm compresses the .deb with the system xz through tar. Threaded mode
// takes seconds on a many-core runner instead of about two minutes.
buildEnv.XZ_DEFAULTS = "-T0";
}
if (!options.signed) {
buildEnv.CSC_IDENTITY_AUTO_DISCOVERY = "false";
delete buildEnv.CSC_LINK;