This commit is contained in:
shump
2026-01-15 11:11:42 -06:00
commit 7562a4ce14
67 changed files with 5636 additions and 0 deletions

97
src/deploy/README.md Normal file
View File

@@ -0,0 +1,97 @@
# Deployment Scripts
This folder contains scripts to build release packages for different platforms.
## Prerequisites
- .NET 10.0 SDK installed
- For macOS builds: Run on macOS
- For Linux builds: Can be run on Linux or macOS
- For Windows builds: Run on Windows with PowerShell
- For Windows icon creation: Python 3 with Pillow (`pip3 install Pillow`)
## Usage
### macOS
```bash
./deploy/build-macos.sh
```
Creates a complete `.app` bundle with:
- Proper macOS application structure
- Application icon embedded
- Info.plist with metadata
- Ready for immediate distribution or installation to /Applications
Automatically detects your Mac architecture (Intel or Apple Silicon).
**Output:**
- Apple Silicon: `./bin/Release/osx-arm64/OrmentiaMarkus.app`
- Intel: `./bin/Release/osx-x64/OrmentiaMarkus.app`
### Windows
```powershell
.\deploy\build-windows.ps1
```
Creates a self-contained `.exe` file with:
- Embedded application icon
- All dependencies bundled
- Single-file executable ready for distribution
**Output:** `.\bin\Release\win-x64\OrmentiaMarkus.exe`
**Note:** Icon file (`Assets/AppIcon.ico`) must be created first. Run `bash deploy/create-windows-icon.sh` from macOS/Linux.
### Linux
```bash
./deploy/build-linux.sh
```
Creates a complete application package with:
- Executable binary
- .desktop file for menu integration
- Application icon
- Launcher script
- Installation README
**Output:** `./bin/Release/linux-x64/OrmentiaMarkus/` folder (ready to archive and distribute)
## Helper Scripts
### Create Windows Icon
```bash
./deploy/create-windows-icon.sh
```
Converts PNG icons to Windows .ico format. Requires Python 3 with Pillow library.
## Build Options
All scripts build with the following options:
- **Self-contained**: Includes the .NET runtime (no need to install .NET on target system)
- **Release configuration**: Optimized for production
- **Platform-specific packaging**: Proper application bundles for each OS
## What Gets Built
| Platform | Output Format | Icon | Ready to Distribute |
|----------|---------------|------|---------------------|
| macOS | `.app` bundle | ✓ | ✓ |
| Windows | `.exe` file | ✓ | ✓ |
| Linux | App folder | ✓ | ✓ (archive it) |
## Distribution
- **macOS**: Distribute the `.app` file (optionally create a DMG)
- **Windows**: Distribute the `.exe` file (optionally create an installer)
- **Linux**: Archive the folder as `.tar.gz` or create an AppImage
## Cross-Platform Building
Note: While you can use `dotnet publish` to cross-compile, the packaging scripts must run on their target OS to create proper platform-specific bundles.

93
src/deploy/build-linux.sh Executable file
View File

@@ -0,0 +1,93 @@
#!/bin/bash
# Build script for Linux release binary and create application package
set -e
echo "Building Markus for Linux..."
# Navigate to project root
cd "$(dirname "$0")/.."
# Clean previous builds
echo "Cleaning previous builds..."
dotnet clean MarkdownEditor.csproj -c Release
# Build for Linux x64
echo "Building for Linux x64..."
dotnet publish MarkdownEditor.csproj \
-c Release \
-r linux-x64 \
--self-contained true \
-p:PublishSingleFile=true \
-p:IncludeNativeLibrariesForSelfExtract=true \
-o ./bin/Release/linux-x64/publish
# Create application directory structure
APP_DIR="./bin/Release/linux-x64/OrmentiaMarkus"
echo "Creating application package..."
rm -rf "$APP_DIR"
mkdir -p "$APP_DIR"
mkdir -p "$APP_DIR/bin"
mkdir -p "$APP_DIR/share/applications"
mkdir -p "$APP_DIR/share/icons/hicolor/256x256/apps"
# Copy executable
cp ./bin/Release/linux-x64/publish/OrmentiaMarkus "$APP_DIR/bin/"
chmod +x "$APP_DIR/bin/OrmentiaMarkus"
# Copy icon
if [ -f "Assets/AppIcon.iconset/icon_256x256.png" ]; then
cp "Assets/AppIcon.iconset/icon_256x256.png" "$APP_DIR/share/icons/hicolor/256x256/apps/ormentia-markus.png"
fi
# Create .desktop file
cat > "$APP_DIR/share/applications/ormentia-markus.desktop" << EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Markus
Comment=A Simple Markdown Editor
Exec=OrmentiaMarkus
Icon=ormentia-markus
Categories=Office;TextEditor;Utility;
Terminal=false
StartupNotify=true
EOF
# Create launcher script
cat > "$APP_DIR/OrmentiaMarkus" << 'EOF'
#!/bin/bash
# Launcher script for Markus
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
exec "$SCRIPT_DIR/bin/OrmentiaMarkus" "$@"
EOF
chmod +x "$APP_DIR/OrmentiaMarkus"
# Create README
cat > "$APP_DIR/README.txt" << EOF
Markus - A Simple Markdown Editor
==================================
Installation:
1. Extract this archive to your preferred location (e.g., /opt or ~/Applications)
2. Run ./OrmentiaMarkus to launch the application
3. (Optional) Copy share/applications/ormentia-markus.desktop to ~/.local/share/applications/
for desktop menu integration
© 2025 Ormentia. All rights reserved.
https://ormentia.com
EOF
# Clean up publish directory
rm -rf ./bin/Release/linux-x64/publish
echo ""
echo "✓ Build completed successfully!"
echo "Application package: ./bin/Release/linux-x64/OrmentiaMarkus/"
echo ""
echo "You can now:"
echo " 1. Run ./bin/Release/linux-x64/OrmentiaMarkus/OrmentiaMarkus"
echo " 2. Archive and distribute the OrmentiaMarkus folder"
echo " 3. Install to /opt or ~/Applications"
echo ""

110
src/deploy/build-macos.sh Executable file
View File

@@ -0,0 +1,110 @@
#!/bin/bash
# Build script for macOS release binary and create .app bundle
set -e
echo "Building Markus for macOS..."
# Navigate to project root
cd "$(dirname "$0")/.."
# Clean previous builds
echo "Cleaning previous builds..."
dotnet clean MarkdownEditor.csproj -c Release
# Determine architecture
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
RUNTIME="osx-arm64"
echo "Building for Apple Silicon (ARM64)..."
else
RUNTIME="osx-x64"
echo "Building for Intel (x64)..."
fi
# Build for macOS (not as single file - we need dependencies accessible)
echo "Building application..."
dotnet publish MarkdownEditor.csproj \
-c Release \
-r $RUNTIME \
--self-contained true \
-o ./bin/Release/$RUNTIME/publish
# Create .app bundle structure
APP_NAME="OrmentiaMarkus.app"
APP_PATH="./bin/Release/$RUNTIME/$APP_NAME"
CONTENTS_PATH="$APP_PATH/Contents"
MACOS_PATH="$CONTENTS_PATH/MacOS"
RESOURCES_PATH="$CONTENTS_PATH/Resources"
echo "Creating .app bundle structure..."
rm -rf "$APP_PATH"
mkdir -p "$MACOS_PATH"
mkdir -p "$RESOURCES_PATH"
# Copy all files from publish to MacOS
echo "Copying application files..."
cp -R ./bin/Release/$RUNTIME/publish/* "$MACOS_PATH/"
# Make the executable actually executable
chmod +x "$MACOS_PATH/OrmentiaMarkus"
# Copy icon
echo "Copying application icon..."
if [ -f "./Assets/AppIcon.icns" ]; then
cp "./Assets/AppIcon.icns" "$RESOURCES_PATH/"
else
echo "Warning: AppIcon.icns not found, app will use default icon"
fi
# Create Info.plist
echo "Creating Info.plist..."
cat > "$CONTENTS_PATH/Info.plist" << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>Markus</string>
<key>CFBundleDisplayName</key>
<string>Markus</string>
<key>CFBundleIdentifier</key>
<string>com.ormentia.markus</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>MRKS</string>
<key>CFBundleExecutable</key>
<string>OrmentiaMarkus</string>
<key>CFBundleIconFile</key>
<string>AppIcon.icns</string>
<key>LSMinimumSystemVersion</key>
<string>10.15</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>© 2025 Ormentia. All rights reserved.</string>
</dict>
</plist>
EOF
# Clean up publish directory
rm -rf ./bin/Release/$RUNTIME/publish
echo ""
echo "✓ Build completed successfully!"
echo "Application bundle: ./bin/Release/$RUNTIME/$APP_NAME"
echo ""
echo "You can now:"
echo " 1. Double-click the app to run it"
echo " 2. Drag it to /Applications folder"
echo " 3. Distribute the .app bundle"
echo ""
# Open Finder to the build location
open ./bin/Release/$RUNTIME

View File

@@ -0,0 +1,43 @@
# Build script for Windows release binary
$ErrorActionPreference = "Stop"
Write-Host "Building Markus for Windows..." -ForegroundColor Cyan
# Navigate to project root
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location "$scriptPath\.."
# Ensure Windows icon exists
if (-not (Test-Path "Assets\AppIcon.ico")) {
Write-Host "Warning: AppIcon.ico not found. Application will use default icon." -ForegroundColor Yellow
Write-Host "Run 'bash deploy/create-windows-icon.sh' on macOS/Linux to create the icon." -ForegroundColor Yellow
}
# Clean previous builds
Write-Host "Cleaning previous builds..." -ForegroundColor Yellow
dotnet clean MarkdownEditor.csproj -c Release
# Build for Windows x64
Write-Host "Building for Windows x64..." -ForegroundColor Yellow
dotnet publish MarkdownEditor.csproj `
-c Release `
-r win-x64 `
--self-contained true `
-p:PublishSingleFile=true `
-p:IncludeNativeLibrariesForSelfExtract=true `
-o .\bin\Release\win-x64
Write-Host ""
Write-Host "✓ Build completed successfully!" -ForegroundColor Green
Write-Host "Application: .\bin\Release\win-x64\OrmentiaMarkus.exe" -ForegroundColor Green
Write-Host ""
Write-Host "You can now:" -ForegroundColor Cyan
Write-Host " 1. Run the .exe file directly" -ForegroundColor Cyan
Write-Host " 2. Copy it to Program Files" -ForegroundColor Cyan
Write-Host " 3. Distribute the .exe file" -ForegroundColor Cyan
Write-Host ""
# Open File Explorer to the build location
Invoke-Item .\bin\Release\win-x64

View File

@@ -0,0 +1,47 @@
#!/bin/bash
# Create Windows .ico file from PNG icons
set -e
cd "$(dirname "$0")/.."
# Check if we have the icon source
if [ ! -f "Assets/AppIcon.iconset/icon_256x256.png" ]; then
echo "Error: icon_256x256.png not found"
exit 1
fi
echo "Creating Windows .ico file..."
# Use Python with PIL if available, otherwise manual creation
if command -v python3 &> /dev/null; then
python3 << 'EOF'
try:
from PIL import Image
import os
# Create ico with multiple sizes
img_256 = Image.open("Assets/AppIcon.iconset/icon_256x256.png")
img_128 = Image.open("Assets/AppIcon.iconset/icon_128x128.png")
img_64 = img_256.resize((64, 64), Image.Resampling.LANCZOS)
img_48 = img_256.resize((48, 48), Image.Resampling.LANCZOS)
img_32 = Image.open("Assets/AppIcon.iconset/icon_32x32.png")
img_16 = Image.open("Assets/AppIcon.iconset/icon_16x16.png")
img_256.save("Assets/AppIcon.ico",
format='ICO',
sizes=[(16, 16), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)],
append_images=[img_16, img_32, img_48, img_64, img_128])
print("✓ Created Assets/AppIcon.ico")
except ImportError:
print("Warning: PIL/Pillow not available. Please install with: pip3 install Pillow")
print("Or manually create AppIcon.ico and place it in Assets/ folder")
exit(1)
EOF
else
echo "Warning: Python3 not available. Cannot create .ico file."
echo "Please manually create AppIcon.ico and place it in Assets/ folder"
exit 1
fi