-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.ps1
More file actions
68 lines (61 loc) · 2.51 KB
/
release.ps1
File metadata and controls
68 lines (61 loc) · 2.51 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
# Paths and Variables
$UI_DIR = "ui"
$UI_DIST = "$UI_DIR/dist"
$CLOUD_DIR = "cloud"
$CLOUD_STATIC_DIR = "$CLOUD_DIR/static"
$RELEASE_DIR = "release"
# Resolve version from latest git tag (strip leading 'v'); fall back to "0.0.0"
$VERSION = (git describe --tags --abbrev=0 2>$null) -replace '^[vV]', ''
if (-not $VERSION) { $VERSION = "0.0.0" }
Write-Host "--- Release version: $VERSION ---" -ForegroundColor Cyan
# 1. Clean Release
Write-Host "--- Cleaning Release ---" -ForegroundColor Cyan
if (Test-Path $RELEASE_DIR) {
Remove-Item -Path "$RELEASE_DIR/hdnsh-cloud",
"$RELEASE_DIR/hdnsh-cloud.exe",
"$RELEASE_DIR/hdnsh-cloud-mac",
"$RELEASE_DIR/hdnsh-server-win.exe",
"$RELEASE_DIR/hdnsh-server-linux",
"$RELEASE_DIR/hdnsh-server-mac" -ErrorAction SilentlyContinue
}
# 2. UI Build (Vite outputs directly to cloud/static via outDir config)
Write-Host "--- Building UI ---" -ForegroundColor Cyan
Push-Location $UI_DIR
npm install
npm run build
Pop-Location
# 4. Backend Package - Windows
Write-Host "--- Packaging Windows Backend ---" -ForegroundColor Cyan
Push-Location $CLOUD_DIR
# Stamp version into version.py
Set-Content "version.py" "__version__ = `"$VERSION`""
# Cleanup old build artifacts
Remove-Item -Recurse -Force build, dist, *.spec -ErrorAction SilentlyContinue
python -m PyInstaller --clean --onefile --name hdnsh-server-win `
--paths "server-apps" `
--paths "handlers" `
--hidden-import "code_chat_console" `
--hidden-import "coding_agent_console" `
--hidden-import "file_editor_console" `
--hidden-import "rss_reader" `
--hidden-import "telegram_chat" `
--hidden-import "web_browser" `
--hidden-import "wiki_browser" `
--hidden-import "command_handler" `
--hidden-import "shared_state" `
--hidden-import "console_manager" `
--hidden-import "chat_handler" `
--hidden-import "help_handler" `
--hidden-import "python_eval_handler" `
--hidden-import "csdb_handler" `
--add-data "static;static" `
--add-data "./oscar/bin/oscar64;oscar/bin" `
--add-data "./oscar/include;oscar/include" `
--add-data "./oscar/docs/C_0*.md;oscar/docs" `
cloud.py
Pop-Location
# Ensure Release Dir exists
if (!(Test-Path $RELEASE_DIR)) { New-Item -ItemType Directory $RELEASE_DIR }
# Copy result to release folder
Copy-Item -Path "$CLOUD_DIR/dist/hdnsh-server-win.exe" -Destination "$RELEASE_DIR/" -Force
Write-Host "--- Release Build Complete! ---" -ForegroundColor Green