feat: package MyAgent as Shirobot plugin
This commit is contained in:
commit
453a8e7793
12 files changed
+913
No files matched your search
@@ -0,0 +1,40 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$projectRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..'))
|
||||
$artifactRoot = [IO.Path]::GetFullPath((Join-Path $projectRoot 'artifacts'))
|
||||
$staging = [IO.Path]::GetFullPath((Join-Path $artifactRoot 'staging'))
|
||||
$output = [IO.Path]::GetFullPath((Join-Path $artifactRoot 'plugin'))
|
||||
|
||||
foreach ($path in @($artifactRoot, $staging, $output)) {
|
||||
if (-not $path.StartsWith($projectRoot + [IO.Path]::DirectorySeparatorChar, [StringComparison]::OrdinalIgnoreCase)) {
|
||||
throw "Refusing to use path outside project: $path"
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location (Join-Path $projectRoot 'MyAgent\MyAgent.Web')
|
||||
try {
|
||||
npm ci
|
||||
if ($LASTEXITCODE -ne 0) { throw 'npm ci failed' }
|
||||
npm run build
|
||||
if ($LASTEXITCODE -ne 0) { throw 'frontend build failed' }
|
||||
}
|
||||
finally { Pop-Location }
|
||||
|
||||
if (Test-Path -LiteralPath $staging) { Remove-Item -LiteralPath $staging -Recurse -Force }
|
||||
if (Test-Path -LiteralPath $output) { Remove-Item -LiteralPath $output -Recurse -Force }
|
||||
New-Item -ItemType Directory -Path $staging -Force | Out-Null
|
||||
New-Item -ItemType Directory -Path $output -Force | Out-Null
|
||||
|
||||
dotnet publish (Join-Path $projectRoot 'Shirobot.Plugin.MyAgent.csproj') -c Release -o $staging
|
||||
if ($LASTEXITCODE -ne 0) { throw 'plugin publish failed' }
|
||||
|
||||
$files = @('MyAgent.dll', 'Shirobot.Plugin.MyAgent.dll', 'Shirobot.Plugin.MyAgent.deps.json', 'HtmlAgilityPack.dll')
|
||||
$files += Get-ChildItem -LiteralPath $staging -Filter 'UglyToad.PdfPig*.dll' -File | Select-Object -ExpandProperty Name
|
||||
foreach ($file in $files) {
|
||||
$from = Join-Path $staging $file
|
||||
if (-not (Test-Path -LiteralPath $from)) { throw "Missing publish file: $file" }
|
||||
Copy-Item -LiteralPath $from -Destination (Join-Path $output $file)
|
||||
}
|
||||
Copy-Item -LiteralPath (Join-Path $staging 'wwwroot') -Destination (Join-Path $output 'wwwroot') -Recurse
|
||||
|
||||
Write-Host "Plugin package ready: $output"
|
||||
Reference in new issue
Block a user