Skip to content

Commit b7e8e1d

Browse files
refactor: pin linuxdeploy in make/yarn build process instead of github workflow
- pulls fix for janhq#5463 out of the github release workflow and into the make/yarn build process - implements a wrapper script that pins linuxdeploy and injects a new location for XDG_CACHE_HOME into the build pipeline, allowing manipulating .cache/tauri without tainting the hosts .cache - adds ./.cache (project_root/.cache) to make clean and mise clean task - remove .devcontainer/buildAppImage.sh, obsolete now that extra build steps have been removed from the github workflow and incorporated in the normal build process
1 parent 42f094d commit b7e8e1d

File tree

6 files changed

+33
-31
lines changed

6 files changed

+33
-31
lines changed

.devcontainer/buildAppImage.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

.github/workflows/template-tauri-build-linux-x64.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ jobs:
145145
fi
146146
- name: Build app
147147
run: |
148-
# Pin linuxdeploy version to prevent @tauri-apps/cli-linux-x64-gnu from pulling in an outdated version
149-
TAURI_TOOLKIT_PATH="${XDG_CACHE_HOME:-$HOME/.cache}/tauri"
150-
mkdir -p "$TAURI_TOOLKIT_PATH"
151-
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/1-alpha-20250213-2/linuxdeploy-x86_64.AppImage -O "$TAURI_TOOLKIT_PATH/linuxdeploy-x86_64.AppImage"
152-
chmod +x "$TAURI_TOOLKIT_PATH/linuxdeploy-x86_64.AppImage"
153-
154148
make build-tauri
155149
156150
APP_IMAGE=./src-tauri/target/release/bundle/appimage/$(ls ./src-tauri/target/release/bundle/appimage/ | grep AppImage | head -1)

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ else ifeq ($(shell uname -s),Linux)
8282
rm -rf ./src-tauri/target
8383
rm -rf "~/jan/extensions"
8484
rm -rf "~/.cache/jan*"
85+
rm -rf "./.cache"
8586
else
8687
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
8788
find . -name ".next" -type d -exec rm -rf '{}' +

mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
164164
rm -rf ./src-tauri/target 2>/dev/null || true
165165
rm -rf ~/jan/extensions 2>/dev/null || true
166166
rm -rf "~/.cache/jan*" 2>/dev/null || true
167+
rm -rf "./.cache" 2>/dev/null || true
167168
else
168169
# macOS cleanup (matches Makefile)
169170
find . -name "node_modules" -type d -prune -exec rm -rf '{}' + 2>/dev/null || true

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"copy:lib:darwin": "mkdir -p \"./src-tauri/resources/lib/\"",
3535
"download:bin": "node ./scripts/download-bin.mjs",
3636
"build:tauri:win32": "yarn download:bin && yarn tauri build",
37-
"build:tauri:linux": "yarn download:bin && yarn tauri build && ./src-tauri/build-utils/buildAppImage.sh",
37+
"build:tauri:linux": "yarn download:bin && ./src-tauri/build-utils/shim-linuxdeploy.sh yarn tauri build && ./src-tauri/build-utils/buildAppImage.sh",
3838
"build:tauri:darwin": "yarn tauri build --target universal-apple-darwin",
3939
"build:tauri": "yarn install:cortex && yarn build:icon && yarn copy:assets:tauri && run-script-os",
4040
"build:icon": "tauri icon ./src-tauri/icons/icon.png",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# wrapper script to pin linuxdeploy version and inject environment variables into the
5+
# build process. While yarn supports injecting environment vairables via env files,
6+
# this applies to all yarn scripts. Using a wrapper allows granular control over
7+
# when environment variables are injected, and avoids tainting the system .cache
8+
9+
# avoid redownloading corepack if possible
10+
export COREPACK_HOME=${COREPACK_HOME:-${XDG_CACHE_HOME:-$HOME/.cache}/node/corepack}
11+
# move cache home to <project root>/.cache
12+
export XDG_CACHE_HOME=${PWD}/.cache
13+
14+
LINUXDEPLOY_VER="1-alpha-20250213-2"
15+
LINUXDEPLOY="$XDG_CACHE_HOME/tauri/linuxdeploy-$LINUXDEPLOY_VER-x86_64.AppImage"
16+
SYMLINK="$XDG_CACHE_HOME/tauri/linuxdeploy-x86_64.AppImage"
17+
18+
mkdir -p "$XDG_CACHE_HOME/tauri"
19+
20+
if [ ! -f "$LINUXDEPLOY" ]; then
21+
GLOB_PATTERN="$XDG_CACHE_HOME/tauri/linuxdeploy-*-x86_64.AppImage"
22+
rm -f $GLOB_PATTERN
23+
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/$LINUXDEPLOY_VER/linuxdeploy-x86_64.AppImage" -O "$LINUXDEPLOY"
24+
chmod a+x "$LINUXDEPLOY"
25+
fi
26+
27+
rm -f "$SYMLINK"
28+
ln -s "$LINUXDEPLOY" "$SYMLINK"
29+
30+
"$@"

0 commit comments

Comments
 (0)