44 lines
1.4 KiB
PowerShell
44 lines
1.4 KiB
PowerShell
# Better-EN5 自动构建与发布脚本
|
|
param(
|
|
[string]$Version = "1.1.0",
|
|
[switch]$Push
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$dotnet = "C:\Program Files\dotnet\dotnet.exe"
|
|
$repoDir = Split-Path -Parent $PSScriptRoot
|
|
echo $ENV:output_folder
|
|
# 设置 PATH
|
|
$env:Path = "C:\Program Files\dotnet;C:\Program Files\Git\bin;$env:Path"
|
|
|
|
Write-Host "=== Better-EN5 构建脚本 ===" -ForegroundColor Cyan
|
|
Write-Host "版本: $Version" -ForegroundColor White
|
|
Write-Host ""
|
|
|
|
# 1. 构建
|
|
Write-Host "[1/3] 构建项目..." -ForegroundColor Yellow
|
|
& $dotnet build -c Release "$repoDir\Better-EN5"
|
|
if (-not $?) { Write-Host "构建失败" -ForegroundColor Red; exit 1 }
|
|
Write-Host "构建成功" -ForegroundColor Green
|
|
|
|
# 2. 安装到希沃白板
|
|
Write-Host "[2/3] 安装到希沃白板..." -ForegroundColor Yellow
|
|
& "$repoDir\scripts\install.ps1" -BuildConfig Release
|
|
if (-not $?) { Write-Host "安装失败" -ForegroundColor Red; exit 1 }
|
|
Write-Host "安装成功" -ForegroundColor Green
|
|
|
|
# 3. Git 提交与推送
|
|
if ($Push) {
|
|
Write-Host "[3/3] 推送至远程仓库..." -ForegroundColor Yellow
|
|
Set-Location $repoDir
|
|
git add -A
|
|
git commit -m "v$Version: 自动构建发布"
|
|
git tag "v$Version"
|
|
git push origin main --tags
|
|
Write-Host "推送成功" -ForegroundColor Green
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "=== 完成 ===" -ForegroundColor Green
|
|
Write-Host "安装文件: $repoDir\bin\Release\Better-Seewo 增强插件.$Version.exe" -ForegroundColor Cyan
|