From 63d4991d63b7271d2e771ea2f175863b762b9be4 Mon Sep 17 00:00:00 2001 From: hrsvrn Date: Tue, 23 Jun 2026 03:38:37 +0530 Subject: [PATCH] fixed workflow --- .github/workflows/electron-build.yml | 15 ++++++++++++++- apps/x/apps/main/bundle.mjs | 23 +++++++++++++++++++++++ apps/x/apps/main/forge.config.cjs | 11 +++++++++-- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/.github/workflows/electron-build.yml b/.github/workflows/electron-build.yml index 787e28e6..e68ce4f4 100644 --- a/.github/workflows/electron-build.yml +++ b/.github/workflows/electron-build.yml @@ -163,12 +163,25 @@ jobs: run: pnpm install --frozen-lockfile working-directory: apps/x + - name: Build node-pty native binary for Linux + working-directory: apps/x + run: | + # node-pty ships prebuilt binaries only for darwin/win32; compile the + # linux-x64 binary so bundle.mjs can stage it into the package. Without + # this the Linux app crashes on launch (missing prebuilds/linux-x64/pty.node). + PTY="node_modules/.pnpm/node-pty@1.1.0/node_modules/node-pty" + cd "$PTY" + npx node-gyp rebuild + mkdir -p prebuilds/linux-x64 + cp build/Release/pty.node prebuilds/linux-x64/ + - name: Build electron app env: VITE_PUBLIC_POSTHOG_KEY: ${{ secrets.VITE_PUBLIC_POSTHOG_KEY }} VITE_PUBLIC_POSTHOG_HOST: ${{ secrets.VITE_PUBLIC_POSTHOG_HOST }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx electron-forge publish --arch=x64,arm64 --platform=linux + ROWBOAT_SKIP_PACMAN: '1' # Arch Linux package is built locally only, never in CI + run: npx electron-forge publish --arch=x64 --platform=linux working-directory: apps/x/apps/main - name: Upload workflow artifacts diff --git a/apps/x/apps/main/bundle.mjs b/apps/x/apps/main/bundle.mjs index fa62d0db..548e037c 100644 --- a/apps/x/apps/main/bundle.mjs +++ b/apps/x/apps/main/bundle.mjs @@ -11,6 +11,7 @@ import * as esbuild from 'esbuild'; import { readFile } from 'node:fs/promises'; +import { execSync } from 'node:child_process'; import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; @@ -66,6 +67,28 @@ for (const dir of fs.readdirSync(prebuildsDir)) { const helper = path.join(prebuildsDir, dir, 'spawn-helper'); if (fs.existsSync(helper)) fs.chmodSync(helper, 0o755); } + +// Self-heal: node-pty ships prebuilt binaries only for darwin/win32, so on any +// host whose prebuild is absent (notably Linux) the staged package has no loadable +// pty.node and the app crashes on launch. Compile the native module for the host +// platform+arch if needed and stage it under prebuilds/-/, where +// node-pty's loader looks first. Keeps dev and CI working without a manual node-gyp +// step (the CI workflow's explicit build is the fast path; this is the safety net). +const hostTriple = `${process.platform}-${process.arch}`; +const stagedBinary = path.join(prebuildsDir, hostTriple, 'pty.node'); +if (!fs.existsSync(stagedBinary)) { + const builtBinary = path.join(ptySrc, 'build', 'Release', 'pty.node'); + if (!fs.existsSync(builtBinary)) { + console.log(`node-pty: no prebuilt binary for ${hostTriple}; compiling with node-gyp…`); + execSync('npx node-gyp rebuild', { cwd: ptySrc, stdio: 'inherit' }); + } + if (!fs.existsSync(builtBinary)) { + throw new Error(`node-pty: failed to produce a native binary for ${hostTriple}`); + } + fs.mkdirSync(path.dirname(stagedBinary), { recursive: true }); + fs.copyFileSync(builtBinary, stagedBinary); + console.log(`✅ node-pty: staged ${hostTriple}/pty.node`); +} console.log('✅ node-pty staged in .package/node_modules'); // Bundle the vendored agent-slack CLI into a single self-contained script next diff --git a/apps/x/apps/main/forge.config.cjs b/apps/x/apps/main/forge.config.cjs index 5e33bb49..ca0fe540 100644 --- a/apps/x/apps/main/forge.config.cjs +++ b/apps/x/apps/main/forge.config.cjs @@ -5,6 +5,12 @@ const path = require('path'); const pkg = require('./package.json'); +// The Arch Linux (pacman) package is meant only for local builds on an Arch host +// with makepkg. It already self-skips elsewhere (maker-pacman checks for makepkg), +// but CI sets ROWBOAT_SKIP_PACMAN=1 to disable it explicitly — GitHub runners are +// Ubuntu and shouldn't attempt to ship an Arch package. +const SKIP_PACMAN = process.env.ROWBOAT_SKIP_PACMAN === '1'; + // Stage the ACP coding-adapters (@agentclientprotocol/*-acp) and their full // production dependency closure into the packaged app. // @@ -178,7 +184,8 @@ module.exports = { } } }, - { + // Arch Linux package — local-only; disabled in CI via ROWBOAT_SKIP_PACMAN. + ...(SKIP_PACMAN ? [] : [{ name: require.resolve('./makers/maker-pacman.cjs'), platforms: ['linux'], config: { @@ -192,7 +199,7 @@ module.exports = { icon: path.join(__dirname, 'icons/icon.png'), mimeType: ['x-scheme-handler/rowboat'], } - }, + }]), { name: '@electron-forge/maker-zip', platform: ["darwin", "win32", "linux"],