#!/usr/bin/env bash # CI build script for macOS and Linux (Gitea/GitHub Actions). set -euo pipefail echo "=== CI build: $(uname -s) ===" python -m pip install --upgrade pip pip install -r requirements-build.txt export PLAYWRIGHT_BROWSERS_PATH=0 playwright install chromium if [[ "$(uname)" == "Linux" ]]; then sudo apt-get update sudo apt-get install -y python3-tk tk-dev sudo playwright install-deps chromium fi pyinstaller --noconfirm --clean build/scribd_gui.spec if [[ "$(uname)" == "Darwin" ]]; then APP="dist/Scribd PDF Downloader.app" if [[ ! -d "$APP" ]]; then echo "Error: $APP not found" exit 1 fi codesign --force --deep --sign - "$APP" 2>/dev/null || true rm -f "dist/Scribd-PDF-Downloader-macOS.zip" ditto -c -k --sequesterRsrc --keepParent "$APP" "dist/Scribd-PDF-Downloader-macOS.zip" echo "Created dist/Scribd-PDF-Downloader-macOS.zip" else DIR="dist/Scribd PDF Downloader" if [[ ! -d "$DIR" ]]; then echo "Error: $DIR not found" exit 1 fi cp -f config.ini "$DIR/" 2>/dev/null || true chmod +x "$DIR/Scribd PDF Downloader" 2>/dev/null || true rm -f "dist/Scribd-PDF-Downloader-Linux.tar.gz" tar -czf "dist/Scribd-PDF-Downloader-Linux.tar.gz" -C dist "Scribd PDF Downloader" echo "Created dist/Scribd-PDF-Downloader-Linux.tar.gz" fi