Add Gitea Actions CI/CD pipeline
- .gitea/workflows/release.yml — multi-platform build (linux native + windows cross via wine) - requirements.txt — all pip dependencies with version pins - PKGBUILD — Arch Linux build reference - build-scripts/build-linux-portable.sh — Linux portable/AppImage builder - build-scripts/build-windows.ps1 — Windows PyInstaller + Inno Setup builder
This commit is contained in:
Executable
+133
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env bash
|
||||
# =============================================================================
|
||||
# Warlock Studio — Linux Portable Build Script
|
||||
# =============================================================================
|
||||
# Builds a portable AppDir/AppImage or tar.gz of the PyInstaller output.
|
||||
#
|
||||
# Usage:
|
||||
# ./build-scripts/build-linux-portable.sh [--appimage] [--output-dir=./dist]
|
||||
#
|
||||
# Requires: python3, pip, pyinstaller, (optional: appimagetool for --appimage)
|
||||
# =============================================================================
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
APP_NAME="Warlock-Studio"
|
||||
BUILD_DIR="dist"
|
||||
OUTPUT_DIR="${PROJECT_DIR}/${BUILD_DIR}"
|
||||
|
||||
# ---- Parse arguments ----
|
||||
BUILD_APPIMAGE=false
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--appimage) BUILD_APPIMAGE=true; shift ;;
|
||||
--output-dir=*) OUTPUT_DIR="${1#*=}"; shift ;;
|
||||
--output-dir) OUTPUT_DIR="$2"; shift 2 ;;
|
||||
*) echo "Unknown option: $1"; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "=========================================="
|
||||
echo " Warlock Studio — Linux Build"
|
||||
echo "=========================================="
|
||||
|
||||
# ---- Step 1: Install system dependencies ----
|
||||
echo "[1/5] Checking system dependencies..."
|
||||
for cmd in python3 pip3; do
|
||||
if ! command -v "$cmd" &>/dev/null; then
|
||||
echo "ERROR: $cmd not found. Install python3 and pip."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
# ---- Step 2: Install Python dependencies ----
|
||||
echo "[2/5] Installing Python dependencies..."
|
||||
pip3 install --upgrade pip wheel setuptools
|
||||
pip3 install -r "${PROJECT_DIR}/requirements.txt"
|
||||
pip3 install pyinstaller
|
||||
|
||||
# ---- Step 3: Build with PyInstaller ----
|
||||
echo "[3/5] Building with PyInstaller..."
|
||||
pyinstaller "${PROJECT_DIR}/Warlock-Studio.spec" --noconfirm --distpath "${OUTPUT_DIR}"
|
||||
|
||||
# Verify the binary was created
|
||||
if [ -f "${OUTPUT_DIR}/${APP_NAME}/${APP_NAME}" ]; then
|
||||
echo " Binary: ${OUTPUT_DIR}/${APP_NAME}/${APP_NAME}"
|
||||
file "${OUTPUT_DIR}/${APP_NAME}/${APP_NAME}"
|
||||
elif [ -f "${OUTPUT_DIR}/${APP_NAME}/${APP_NAME}.exe" ]; then
|
||||
echo " Binary: ${OUTPUT_DIR}/${APP_NAME}/${APP_NAME}.exe"
|
||||
else
|
||||
echo "ERROR: Build output not found at ${OUTPUT_DIR}/${APP_NAME}/"
|
||||
ls -la "${OUTPUT_DIR}/${APP_NAME}" 2>/dev/null || echo " (directory missing)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ---- Step 4: Create portable tar.gz ----
|
||||
echo "[4/5] Creating portable tar.gz..."
|
||||
VERSION=""
|
||||
if [ -n "${CI_COMMIT_TAG:-}" ]; then
|
||||
VERSION="${CI_COMMIT_TAG#v}"
|
||||
elif command -v git &>/dev/null; then
|
||||
VERSION="$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0")"
|
||||
VERSION="${VERSION#v}"
|
||||
fi
|
||||
[ -z "$VERSION" ] && VERSION="dev"
|
||||
|
||||
ARCHIVE_NAME="${APP_NAME}-${VERSION}-linux-x64.tar.gz"
|
||||
tar -czf "${ARCHIVE_NAME}" -C "${OUTPUT_DIR}" "${APP_NAME}"
|
||||
echo " Archive: ${ARCHIVE_NAME} ($(du -h "${ARCHIVE_NAME}" | cut -f1))"
|
||||
|
||||
# ---- Step 5: Optionally build AppImage ----
|
||||
if [ "$BUILD_APPIMAGE" = true ]; then
|
||||
echo "[5/5] Creating AppImage..."
|
||||
if ! command -v appimagetool &>/dev/null && [ ! -f "appimagetool" ]; then
|
||||
echo " Downloading appimagetool..."
|
||||
wget -q "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" -O appimagetool
|
||||
chmod +x appimagetool
|
||||
fi
|
||||
APPIMAGETOOL=$(command -v appimagetool || echo "./appimagetool")
|
||||
|
||||
# Create AppDir structure
|
||||
APPDIR="${OUTPUT_DIR}/${APP_NAME}.AppDir"
|
||||
mkdir -p "${APPDIR}/usr/bin"
|
||||
cp -r "${OUTPUT_DIR}/${APP_NAME}"/* "${APPDIR}/usr/bin/"
|
||||
|
||||
# Create desktop entry
|
||||
cat > "${APPDIR}/${APP_NAME}.desktop" << EOF
|
||||
[Desktop Entry]
|
||||
Name=Warlock Studio
|
||||
Comment=AI-powered video upscaling, restoration and frame interpolation
|
||||
Exec=${APP_NAME}
|
||||
Icon=${APP_NAME}
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Graphics;Video;
|
||||
EOF
|
||||
|
||||
# Copy icon
|
||||
cp "${PROJECT_DIR}/logo.ico" "${APPDIR}/${APP_NAME}.png" 2>/dev/null || true
|
||||
|
||||
# Create AppRun
|
||||
cat > "${APPDIR}/AppRun" << 'APPRUN_EOF'
|
||||
#!/usr/bin/env bash
|
||||
HERE="$(dirname "$(readlink -f "$0")")"
|
||||
export PATH="${HERE}/usr/bin:${PATH}"
|
||||
export LD_LIBRARY_PATH="${HERE}/usr/bin/_internal:${LD_LIBRARY_PATH}"
|
||||
exec "${HERE}/usr/bin/Warlock-Studio" "$@"
|
||||
APPRUN_EOF
|
||||
chmod +x "${APPDIR}/AppRun"
|
||||
|
||||
# Build AppImage
|
||||
ARCH=x86_64 "$APPIMAGETOOL" "${APPDIR}" "${APP_NAME}-${VERSION}-x86_64.AppImage"
|
||||
echo " AppImage: ${APP_NAME}-${VERSION}-x86_64.AppImage"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo " BUILD COMPLETE"
|
||||
echo "=========================================="
|
||||
echo "Output: ${ARCHIVE_NAME}"
|
||||
[ "$BUILD_APPIMAGE" = true ] && echo "AppImage: ${APP_NAME}-${VERSION}-x86_64.AppImage"
|
||||
Reference in New Issue
Block a user