feat: add Debian package building to CI pipeline and local build
All checks were successful
CI/CD / lint (push) Successful in 47s
CI/CD / typecheck (push) Successful in 47s
CI/CD / test (push) Successful in 59s
CI/CD / build (push) Successful in 3m59s
CI/CD / publish-rpm (push) Successful in 38s
CI/CD / publish-deb (push) Successful in 29s
CI/CD / smoke (push) Successful in 8m23s

Support DEB packaging alongside RPM for Debian trixie (13/stable),
forky (14/testing), Ubuntu noble (24.04 LTS), and plucky (25.04).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-03-09 22:43:40 +00:00
parent 3088a17ac0
commit 9c479e5615
6 changed files with 203 additions and 1 deletions

53
scripts/build-deb.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"
# Load .env if present
if [ -f .env ]; then
set -a; source .env; set +a
fi
# Ensure tools are on PATH
export PATH="$HOME/.npm-global/bin:$HOME/.bun/bin:$HOME/.local/bin:$PATH"
# Check if binaries already exist (build-rpm.sh may have been run first)
if [ ! -f dist/mcpctl ] || [ ! -f dist/mcpctl-local ]; then
echo "==> Binaries not found, building from scratch..."
echo ""
echo "==> Running unit tests..."
pnpm test:run
echo ""
echo "==> Building TypeScript..."
pnpm build
echo "==> Generating shell completions..."
pnpm completions:generate
echo "==> Bundling standalone binaries..."
mkdir -p dist
# Ink optionally imports react-devtools-core which isn't installed.
# Provide a no-op stub so bun can bundle it (it's only invoked when DEV=true).
if [ ! -e node_modules/react-devtools-core ]; then
ln -s ../src/cli/stubs/react-devtools-core node_modules/react-devtools-core
fi
bun build src/cli/src/index.ts --compile --outfile dist/mcpctl
bun build src/mcplocal/src/main.ts --compile --outfile dist/mcpctl-local
else
echo "==> Using existing binaries in dist/"
fi
echo "==> Packaging DEB..."
rm -f dist/mcpctl-*.deb dist/mcpctl_*.deb
nfpm pkg --packager deb --target dist/
DEB_FILE=$(ls dist/mcpctl*.deb 2>/dev/null | head -1)
echo "==> Built: $DEB_FILE"
echo " Size: $(du -h "$DEB_FILE" | cut -f1)"
dpkg-deb --info "$DEB_FILE" 2>/dev/null || true