v1.1.1: 构建修复,优化警告,新增自动脚本
This commit is contained in:
43
scripts/build-release.ps1
Normal file
43
scripts/build-release.ps1
Normal file
@@ -0,0 +1,43 @@
|
||||
# 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
|
||||
54
scripts/install.ps1
Normal file
54
scripts/install.ps1
Normal file
@@ -0,0 +1,54 @@
|
||||
# Better-EN5 插件安装脚本
|
||||
# 以管理员身份运行
|
||||
param(
|
||||
[string]$BuildConfig = "Release"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$pluginName = "Better-EN5"
|
||||
$seewoPath = "$env:ProgramFiles(x86)\Seewo\EasiNote5"
|
||||
$dotnet = "C:\Program Files\dotnet\dotnet.exe"
|
||||
|
||||
# 查找最新版本目录
|
||||
$versionDirs = Get-ChildItem "$seewoPath\EasiNote5_*" -Directory | Sort-Object Name -Descending
|
||||
if ($versionDirs.Count -eq 0) {
|
||||
Write-Host "未找到希沃白板安装目录" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
$targetDir = Join-Path $versionDirs[0].FullName "Main\Extensions\$pluginName"
|
||||
$sourceDir = Join-Path $PSScriptRoot "..\Better-EN5\bin\$BuildConfig\net6.0-windows"
|
||||
|
||||
Write-Host "安装到: $targetDir" -ForegroundColor Cyan
|
||||
|
||||
# 检查构建输出
|
||||
if (-not (Test-Path $sourceDir)) {
|
||||
Write-Host "未找到构建输出,正在构建..." -ForegroundColor Yellow
|
||||
if (Test-Path $dotnet) {
|
||||
$env:Path = "C:\Program Files\dotnet;$env:Path"
|
||||
& $dotnet build -c $BuildConfig (Join-Path $PSScriptRoot "..\Better-EN5")
|
||||
if (-not $?) { exit 1 }
|
||||
} else {
|
||||
Write-Host "找不到 dotnet 编译器" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# 创建插件目录
|
||||
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
|
||||
|
||||
# 复制插件文件
|
||||
Copy-Item "$sourceDir\*" $targetDir -Recurse -Force
|
||||
Write-Host "插件文件已复制" -ForegroundColor Green
|
||||
|
||||
# 复制 manifest.coin
|
||||
$manifestSource = Join-Path $PSScriptRoot "..\Better-EN5\manifest.coin"
|
||||
if (Test-Path $manifestSource) {
|
||||
Copy-Item $manifestSource $targetDir -Force
|
||||
Write-Host "manifest.coin 已复制" -ForegroundColor Green
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "安装完成!请重启希沃白板以加载插件。" -ForegroundColor Green
|
||||
Write-Host "在希沃白板的右键菜单中可以找到 'Better-Seewo 设置' 入口。" -ForegroundColor Cyan
|
||||
Reference in New Issue
Block a user