Skip to content

Commit 9a7ff81

Browse files
chore(release): add Linux packaging and stable install path
Add first-class Linux package outputs (.deb, .rpm, AppImage), enable updater for packaged Linux, set stable install root to /opt/t3code (keeps visible app name), add podman-based RPM helper, and update CI/docs for packaging. Made-with: Cursor
1 parent 8244fb8 commit 9a7ff81

16 files changed

Lines changed: 1156 additions & 59 deletions

File tree

‎.docs/scripts.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@
1010
- `bun run build` — Builds contracts, web app, and server through Turbo.
1111
- `bun run typecheck` — Strict TypeScript checks for all packages.
1212
- `bun run test` — Runs workspace tests.
13-
- `bun run dist:desktop:artifact -- --platform <mac|linux|win> --target <target> --arch <arch>` — Builds a desktop artifact for a specific platform/target/arch.
13+
- `bun run dist:desktop:artifact -- --platform <mac|linux|win> --target <target[,target2]> --arch <arch>` — Builds a desktop artifact for a specific platform/target/arch.
1414
- `bun run dist:desktop:dmg` — Builds a shareable macOS `.dmg` into `./release`.
1515
- `bun run dist:desktop:dmg:x64` — Builds an Intel macOS `.dmg`.
16-
- `bun run dist:desktop:linux` — Builds a Linux AppImage into `./release`.
16+
- `bun run dist:desktop:linux` — Builds Linux `AppImage`, `.deb`, and `.rpm` artifacts into `./release`.
17+
- `bun run dist:desktop:linux:appimage` — Builds only the Linux AppImage.
18+
- `bun run dist:desktop:linux:deb` — Builds only the Linux `.deb`.
19+
- `bun run dist:desktop:linux:rpm` — Builds only the Linux `.rpm`.
20+
- `bun run dist:desktop:linux:rpm:podman` — Builds the Linux `.rpm` inside a Podman container, useful on Ubuntu hosts that do not have `rpmbuild` installed.
1721
- `bun run dist:desktop:win` — Builds a Windows NSIS installer into `./release`.
1822

1923
## Desktop `.dmg` packaging notes

‎.github/workflows/release.yml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
- name: Install dependencies
6969
run: bun install --frozen-lockfile
7070

71+
- name: Install Linux packaging tools
72+
if: matrix.platform == 'linux'
73+
run: sudo apt-get update && sudo apt-get install -y rpm
74+
7175
- name: Lint
7276
run: bun run lint
7377

@@ -95,10 +99,10 @@ jobs:
9599
platform: mac
96100
target: dmg
97101
arch: x64
98-
- label: Linux x64
102+
- label: Linux x64 packages
99103
runner: ubuntu-24.04
100104
platform: linux
101-
target: AppImage
105+
target: AppImage,deb,rpm
102106
arch: x64
103107
- label: Windows x64
104108
runner: windows-2022
@@ -202,6 +206,8 @@ jobs:
202206
"release/*.dmg" \
203207
"release/*.zip" \
204208
"release/*.AppImage" \
209+
"release/*.deb" \
210+
"release/*.rpm" \
205211
"release/*.exe" \
206212
"release/*.blockmap" \
207213
"release/latest*.yml"; do
@@ -298,6 +304,8 @@ jobs:
298304
release-assets/*.dmg
299305
release-assets/*.zip
300306
release-assets/*.AppImage
307+
release-assets/*.deb
308+
release-assets/*.rpm
301309
release-assets/*.exe
302310
release-assets/*.blockmap
303311
release-assets/latest*.yml

‎DEBIAN/control‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Package: t3code
2+
Version: 0.0.15
3+
License: unknown
4+
Vendor: T3 Tools <[email protected]>
5+
Architecture: amd64
6+
Maintainer: T3 Tools <[email protected]>
7+
Installed-Size: 492821
8+
Depends: libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils, libatspi2.0-0, libuuid1, libsecret-1-0
9+
Recommends: libappindicator3-1
10+
Section: default
11+
Priority: optional
12+
Homepage: https://github.com/pingdotgg/t3code
13+
Description: T3 Code
14+
T3 Code

‎DEBIAN/md5sums‎

Lines changed: 285 additions & 0 deletions
Large diffs are not rendered by default.

‎DEBIAN/postinst‎

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
if type update-alternatives >/dev/null 2>&1; then
4+
# Remove previous link if it doesn't use update-alternatives
5+
if [ -L '/usr/bin/t3code' -a -e '/usr/bin/t3code' -a "`readlink '/usr/bin/t3code'`" != '/etc/alternatives/t3code' ]; then
6+
rm -f '/usr/bin/t3code'
7+
fi
8+
update-alternatives --install '/usr/bin/t3code' 't3code' '/opt/t3code/t3code' 100 || ln -sf '/opt/t3code/t3code' '/usr/bin/t3code'
9+
else
10+
ln -sf '/opt/t3code/t3code' '/usr/bin/t3code'
11+
fi
12+
13+
# Check if user namespaces are supported by the kernel and working with a quick test:
14+
if ! { [[ -L /proc/self/ns/user ]] && unshare --user true; }; then
15+
# Use SUID chrome-sandbox only on systems without user namespaces:
16+
chmod 4755 '/opt/t3code/chrome-sandbox' || true
17+
else
18+
chmod 0755 '/opt/t3code/chrome-sandbox' || true
19+
fi
20+
21+
if hash update-mime-database 2>/dev/null; then
22+
update-mime-database /usr/share/mime || true
23+
fi
24+
25+
if hash update-desktop-database 2>/dev/null; then
26+
update-desktop-database /usr/share/applications || true
27+
fi
28+
29+
# Install apparmor profile. (Ubuntu 24+)
30+
# First check if the version of AppArmor running on the device supports our profile.
31+
# This is in order to keep backwards compatibility with Ubuntu 22.04 which does not support abi/4.0.
32+
# In that case, we just skip installing the profile since the app runs fine without it on 22.04.
33+
#
34+
# Those apparmor_parser flags are akin to performing a dry run of loading a profile.
35+
# https://wiki.debian.org/AppArmor/HowToUse#Dumping_profiles
36+
#
37+
# Unfortunately, at the moment AppArmor doesn't have a good story for backwards compatibility.
38+
# https://askubuntu.com/questions/1517272/writing-a-backwards-compatible-apparmor-profile
39+
if apparmor_status --enabled > /dev/null 2>&1; then
40+
APPARMOR_PROFILE_SOURCE='/opt/t3code/resources/apparmor-profile'
41+
APPARMOR_PROFILE_TARGET='/etc/apparmor.d/t3code'
42+
if apparmor_parser --skip-kernel-load --debug "$APPARMOR_PROFILE_SOURCE" > /dev/null 2>&1; then
43+
cp -f "$APPARMOR_PROFILE_SOURCE" "$APPARMOR_PROFILE_TARGET"
44+
45+
# Updating the current AppArmor profile is not possible and probably not meaningful in a chroot'ed environment.
46+
# Use cases are for example environments where images for clients are maintained.
47+
# There, AppArmor might correctly be installed, but live updating makes no sense.
48+
if ! { [ -x '/usr/bin/ischroot' ] && /usr/bin/ischroot; } && hash apparmor_parser 2>/dev/null; then
49+
# Extra flags taken from dh_apparmor:
50+
# > By using '-W -T' we ensure that any abstraction updates are also pulled in.
51+
# https://wiki.debian.org/AppArmor/Contribute/FirstTimeProfileImport
52+
apparmor_parser --replace --write-cache --skip-read-cache "$APPARMOR_PROFILE_TARGET"
53+
fi
54+
else
55+
echo "Skipping the installation of the AppArmor profile as this version of AppArmor does not seem to support the bundled profile"
56+
fi
57+
fi

‎DEBIAN/postrm‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# Delete the link to the binary
4+
if type update-alternatives >/dev/null 2>&1; then
5+
update-alternatives --remove 't3code' '/usr/bin/t3code'
6+
else
7+
rm -f '/usr/bin/t3code'
8+
fi
9+
10+
APPARMOR_PROFILE_DEST='/etc/apparmor.d/t3code'
11+
12+
# Remove apparmor profile.
13+
if [ -f "$APPARMOR_PROFILE_DEST" ]; then
14+
rm -f "$APPARMOR_PROFILE_DEST"
15+
fi

‎README.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ brew install --cask t3-code
3939
yay -S t3code-bin
4040
```
4141

42+
#### Ubuntu / Debian
43+
44+
Download the latest `.deb` from [GitHub Releases](https://github.com/pingdotgg/t3code/releases) and install it with:
45+
46+
```bash
47+
sudo apt install ./T3-Code-*.deb
48+
```
49+
50+
#### Fedora / RHEL
51+
52+
Download the latest `.rpm` from [GitHub Releases](https://github.com/pingdotgg/t3code/releases) and install it with:
53+
54+
```bash
55+
sudo dnf install ./T3-Code-*.rpm
56+
```
57+
4258
## Some notes
4359

4460
We are very very early in this project. Expect bugs.

‎apps/desktop/src/main.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,6 @@ function handleCheckForUpdatesMenuClick(): void {
561561
isDevelopment,
562562
isPackaged: app.isPackaged,
563563
platform: process.platform,
564-
appImage: process.env.APPIMAGE,
565564
disabledByEnv: process.env.T3CODE_DISABLE_AUTO_UPDATE === "1",
566565
});
567566
if (disabledReason) {
@@ -784,7 +783,6 @@ function shouldEnableAutoUpdates(): boolean {
784783
isDevelopment,
785784
isPackaged: app.isPackaged,
786785
platform: process.platform,
787-
appImage: process.env.APPIMAGE,
788786
disabledByEnv: process.env.T3CODE_DISABLE_AUTO_UPDATE === "1",
789787
}) === null
790788
);

‎apps/desktop/src/updateState.test.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ describe("getAutoUpdateDisabledReason", () => {
6969
isDevelopment: true,
7070
isPackaged: false,
7171
platform: "darwin",
72-
appImage: undefined,
7372
disabledByEnv: false,
7473
}),
7574
).toContain("packaged production builds");
@@ -81,22 +80,20 @@ describe("getAutoUpdateDisabledReason", () => {
8180
isDevelopment: false,
8281
isPackaged: true,
8382
platform: "darwin",
84-
appImage: undefined,
8583
disabledByEnv: true,
8684
}),
8785
).toContain("T3CODE_DISABLE_AUTO_UPDATE");
8886
});
8987

90-
it("reports linux non-AppImage builds as disabled", () => {
88+
it("allows packaged Linux builds when not otherwise disabled", () => {
9189
expect(
9290
getAutoUpdateDisabledReason({
9391
isDevelopment: false,
9492
isPackaged: true,
9593
platform: "linux",
96-
appImage: undefined,
9794
disabledByEnv: false,
9895
}),
99-
).toContain("AppImage");
96+
).toBeNull();
10097
});
10198
});
10299

‎apps/desktop/src/updateState.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export function getAutoUpdateDisabledReason(args: {
3232
isDevelopment: boolean;
3333
isPackaged: boolean;
3434
platform: NodeJS.Platform;
35-
appImage?: string | undefined;
3635
disabledByEnv: boolean;
3736
}): string | null {
3837
if (args.isDevelopment || !args.isPackaged) {
@@ -41,8 +40,5 @@ export function getAutoUpdateDisabledReason(args: {
4140
if (args.disabledByEnv) {
4241
return "Automatic updates are disabled by the T3CODE_DISABLE_AUTO_UPDATE setting.";
4342
}
44-
if (args.platform === "linux" && !args.appImage) {
45-
return "Automatic updates on Linux require running the AppImage build.";
46-
}
4743
return null;
4844
}

0 commit comments

Comments
 (0)