-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
138 lines (113 loc) · 4.52 KB
/
build.ps1
File metadata and controls
138 lines (113 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# MechBay Build Script
# Automates version bumping, dependency sync, PyInstaller build, and distribution packaging
# Stop on first error
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "MechBay Build Script" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Step 1: Bump patch version
Write-Host "[1/6] Bumping patch version..." -ForegroundColor Yellow
uv version --bump patch
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Version bump failed" -ForegroundColor Red
exit 1
}
# Extract new version from pyproject.toml
$version = (Get-Content pyproject.toml | Select-String 'version = "(.+)"').Matches.Groups[1].Value
Write-Host "New version: $version" -ForegroundColor Green
Write-Host ""
# Step 2: Sync dependencies
Write-Host "[2/6] Syncing dependencies..." -ForegroundColor Yellow
uv sync
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Dependency sync failed" -ForegroundColor Red
exit 1
}
Write-Host ""
# Step 3: Build with PyInstaller
Write-Host "[3/6] Building executable with PyInstaller..." -ForegroundColor Yellow
uv run pyinstaller mechbay.spec --clean
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: PyInstaller build failed" -ForegroundColor Red
exit 1
}
Write-Host ""
# Step 4: Create distribution folder
$distFolder = "dist/MechBay_v$version"
Write-Host "[4/6] Creating distribution folder: $distFolder" -ForegroundColor Yellow
if (Test-Path $distFolder) {
Remove-Item -Recurse -Force $distFolder
}
New-Item -ItemType Directory -Path $distFolder | Out-Null
# Copy executable folder
Copy-Item -Recurse "dist/MechBay/*" $distFolder
# Copy .env.example
Copy-Item ".env.example" "$distFolder/.env.example"
# Generate README.txt
$readmeContent = @"
MechBay v$version
================
GETTING STARTED
---------------
1. Double-click MechBay.exe to start the application
2. Your web browser will automatically open to http://127.0.0.1:5001
3. The application runs locally on your computer (no internet required)
4. Close the terminal window to stop the server
DATABASE LOCATION
-----------------
Your miniature inventory is stored in:
%APPDATA%\MechBay\mechbay.db
This is typically located at:
C:\Users\<YourUsername>\AppData\Roaming\MechBay\mechbay.db
BACKING UP YOUR DATA
--------------------
Method 1 - Direct Database Backup (Recommended):
1. Close MechBay if it's running
2. Copy the mechbay.db file from %APPDATA%\MechBay\ to a safe location
3. To restore, copy the backup file back to %APPDATA%\MechBay\
Method 2 - JSON Export/Import:
1. In the web interface, go to Miniatures, Forces, or Lance Templates
2. Click "Export JSON" to download your data
3. Save the JSON file in a safe location
4. To restore, use the "Import JSON" feature
UPDATING TO A NEW VERSION
--------------------------
1. Backup your database (see above)
2. Download the new version
3. Extract and run - your data in %APPDATA% will be preserved
4. If you encounter issues, restore from your backup
TROUBLESHOOTING
---------------
- If the browser doesn't open automatically, navigate to http://127.0.0.1:5001
- If port 5001 is already in use, close other applications or edit .env.example
- For issues, check the terminal window for error messages
- Visit https://github.com/cantis/MechBay for support
CONFIGURATION (Advanced)
------------------------
Create a .env file in the same folder as MechBay.exe to customize settings.
See .env.example for available options.
"@
Set-Content -Path "$distFolder/README.txt" -Value $readmeContent
Write-Host "Distribution folder created successfully" -ForegroundColor Green
Write-Host ""
# Step 5: Create ZIP archive
$zipFile = "dist/MechBay_v$version.zip"
Write-Host "[5/6] Creating ZIP archive: $zipFile" -ForegroundColor Yellow
if (Test-Path $zipFile) {
Remove-Item -Force $zipFile
}
Compress-Archive -Path $distFolder -DestinationPath $zipFile
Write-Host "ZIP archive created successfully" -ForegroundColor Green
Write-Host ""
# Step 6: Summary
Write-Host "[6/6] Build complete!" -ForegroundColor Green
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Build Summary" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Version: $version" -ForegroundColor White
Write-Host "Folder: $distFolder" -ForegroundColor White
Write-Host "ZIP Archive: $zipFile" -ForegroundColor White
Write-Host ""
Write-Host "Distribution is ready for testing or deployment!" -ForegroundColor Green