Actuators/build-release.sh

47 lines
1.5 KiB
Bash

#!/usr/bin/env bash
# 构建所有平台的发布包
set -e
VERSION="1.0.0"
ROOT="$(cd "$(dirname "$0")" && pwd)"
DIST="$ROOT/dist"
echo "=== Building Actuator Reader v$VERSION ==="
# 1. PyInstaller Linux binary
echo "[1/3] Building Linux binary..."
cd "$ROOT"
if [ ! -d .build-venv ]; then
python3 -m venv .build-venv
.build-venv/bin/pip install pyinstaller opencv-python numpy PyQt6
fi
.build-venv/bin/pyinstaller --clean --noconfirm actuator-reader.spec
# 2. DEB package
echo "[2/3] Building .deb package..."
rm -rf packaging/deb/actuator-reader/usr/bin/actuator-reader
cp "$DIST/actuator-reader" packaging/deb/actuator-reader/usr/bin/
cd packaging/deb
dpkg-deb --build --root-owner-group actuator-reader "actuator-reader_${VERSION}_amd64.deb"
cp "actuator-reader_${VERSION}_amd64.deb" "$DIST/"
cd "$ROOT"
# 3. Flatpak bundle (manifest + binary)
echo "[3/3] Preparing Flatpak..."
cp "$DIST/actuator-reader" packaging/flatpak/
cd packaging/flatpak
tar czf "$DIST/actuator-reader-${VERSION}-flatpak-sources.tar.gz" \
actuator-reader \
top.qyhhh.actuator-reader.yml \
top.qyhhh.actuator-reader.desktop \
top.qyhhh.actuator-reader.png \
top.qyhhh.actuator-reader.metainfo.xml
cd "$ROOT"
echo ""
echo "=== Done ==="
echo "Linux binary: dist/actuator-reader"
echo "DEB package: dist/actuator-reader_${VERSION}_amd64.deb"
echo "Flatpak sources: dist/actuator-reader-${VERSION}-flatpak-sources.tar.gz"
echo "Windows: packaging/windows/build.bat (在 Windows 上运行)"