You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
2.1 KiB
82 lines
2.1 KiB
#!/bin/bash
|
|
# build-electron-linux.sh
|
|
# Author: Matthew Raymer
|
|
# Description: Electron Linux build script for TimeSafari application
|
|
# This script builds Electron packages for Linux with support for different formats.
|
|
#
|
|
# Usage: ./scripts/build-electron-linux.sh [deb|prod]
|
|
# - No argument: Builds AppImage
|
|
# - deb: Builds .deb package
|
|
# - prod: Builds production AppImage
|
|
#
|
|
# Exit Codes:
|
|
# 1 - Build failed
|
|
# 2 - Invalid argument
|
|
|
|
# Exit on any error
|
|
set -e
|
|
|
|
# Source common utilities
|
|
source "$(dirname "$0")/common.sh"
|
|
|
|
# Parse command line arguments
|
|
parse_args "$@"
|
|
|
|
# Parse build type argument
|
|
BUILD_TYPE=${1:-"appimage"}
|
|
PRODUCTION=false
|
|
|
|
case $BUILD_TYPE in
|
|
"deb")
|
|
BUILD_TARGET="deb"
|
|
log_info "Building .deb package"
|
|
;;
|
|
"prod")
|
|
BUILD_TARGET="AppImage"
|
|
PRODUCTION=true
|
|
log_info "Building production AppImage"
|
|
;;
|
|
"appimage"|"")
|
|
BUILD_TARGET="AppImage"
|
|
log_info "Building AppImage"
|
|
;;
|
|
*)
|
|
log_error "Invalid build type: $BUILD_TYPE"
|
|
log_error "Usage: $0 [deb|prod]"
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
# Print build header
|
|
print_header "TimeSafari Electron Linux Build"
|
|
log_info "Starting Linux build process at $(date)"
|
|
log_info "Build type: $BUILD_TYPE"
|
|
log_info "Build target: $BUILD_TARGET"
|
|
log_info "Production mode: $PRODUCTION"
|
|
|
|
# Setup environment for Electron build
|
|
setup_build_env "electron" "$PRODUCTION"
|
|
|
|
# Setup application directories
|
|
setup_app_directories
|
|
|
|
# Load environment from .env file if it exists
|
|
load_env_file ".env"
|
|
|
|
# Step 1: Build Electron application
|
|
if [ "$PRODUCTION" = true ]; then
|
|
safe_execute "Building production Electron application" "npm run build:electron-prod" || exit 1
|
|
else
|
|
safe_execute "Building Electron application" "npm run build:electron" || exit 1
|
|
fi
|
|
|
|
# Step 2: Build package
|
|
safe_execute "Building Linux package" "npx electron-builder --linux $BUILD_TARGET" || exit 1
|
|
|
|
# Print build summary
|
|
log_success "Linux build completed successfully!"
|
|
log_info "Package type: $BUILD_TARGET"
|
|
print_footer "Linux Build"
|
|
|
|
# Exit with success
|
|
exit 0
|