generated from MrSphay/codex-agent-repository-kit
Add MrTrust GUI and Gitea release build
Some checks failed
Build MrTrust / build-windows (push) Has been cancelled
Some checks failed
Build MrTrust / build-windows (push) Has been cancelled
This commit is contained in:
70
scripts/New-MrTrustRelease.ps1
Normal file
70
scripts/New-MrTrustRelease.ps1
Normal file
@@ -0,0 +1,70 @@
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[string]$Version = "0.1.0",
|
||||
[string]$OutputDirectory = ".\dist",
|
||||
[string]$SigningThumbprint,
|
||||
[switch]$NoTimestamp,
|
||||
[switch]$AllowUntrustedRoot
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function Resolve-FullPath {
|
||||
param([Parameter(Mandatory)][string]$Path)
|
||||
|
||||
$executionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($Path)
|
||||
}
|
||||
|
||||
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
$output = Resolve-FullPath $OutputDirectory
|
||||
$packageRoot = Join-Path $output "MrTrust-$Version"
|
||||
$zipPath = Join-Path $output "MrTrust-$Version.zip"
|
||||
$exePath = Join-Path $output "MrTrust.exe"
|
||||
|
||||
if (Test-Path -LiteralPath $packageRoot) {
|
||||
Remove-Item -LiteralPath $packageRoot -Recurse -Force
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $packageRoot | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $packageRoot "scripts") | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $packageRoot "assets\certificates") | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $packageRoot "docs") | Out-Null
|
||||
|
||||
& (Join-Path $root "scripts\Build-MrTrustExe.ps1") -OutputPath $exePath
|
||||
|
||||
if ($SigningThumbprint) {
|
||||
$signArguments = @{
|
||||
Path = $exePath
|
||||
CertificateThumbprint = $SigningThumbprint
|
||||
}
|
||||
|
||||
if ($NoTimestamp) {
|
||||
$signArguments.NoTimestamp = $true
|
||||
}
|
||||
|
||||
if ($AllowUntrustedRoot) {
|
||||
$signArguments.AllowUntrustedRoot = $true
|
||||
}
|
||||
|
||||
& (Join-Path $root "scripts\Sign-MrTrustProject.ps1") @signArguments
|
||||
}
|
||||
|
||||
Copy-Item -LiteralPath $exePath -Destination $packageRoot
|
||||
Copy-Item -LiteralPath (Join-Path $root "MrTrust.ps1") -Destination $packageRoot
|
||||
Copy-Item -LiteralPath (Join-Path $root "README.md") -Destination $packageRoot
|
||||
Copy-Item -LiteralPath (Join-Path $root "scripts\Install-MrTrust.ps1") -Destination (Join-Path $packageRoot "scripts")
|
||||
Copy-Item -LiteralPath (Join-Path $root "scripts\Uninstall-MrTrust.ps1") -Destination (Join-Path $packageRoot "scripts")
|
||||
Copy-Item -LiteralPath (Join-Path $root "scripts\Start-MrTrustGui.ps1") -Destination (Join-Path $packageRoot "scripts")
|
||||
Copy-Item -LiteralPath (Join-Path $root "assets\certificates\MrSphay-LocalTrust-Root.cer") -Destination (Join-Path $packageRoot "assets\certificates")
|
||||
Copy-Item -LiteralPath (Join-Path $root "assets\certificates\MrSphay-CodeSigning.cer") -Destination (Join-Path $packageRoot "assets\certificates")
|
||||
Copy-Item -LiteralPath (Join-Path $root "assets\certificates\thumbprints.txt") -Destination (Join-Path $packageRoot "assets\certificates")
|
||||
Copy-Item -LiteralPath (Join-Path $root "docs\security-model.md") -Destination (Join-Path $packageRoot "docs")
|
||||
|
||||
if (Test-Path -LiteralPath $zipPath) {
|
||||
Remove-Item -LiteralPath $zipPath -Force
|
||||
}
|
||||
|
||||
Compress-Archive -Path (Join-Path $packageRoot "*") -DestinationPath $zipPath -Force
|
||||
|
||||
Write-Host "Created release package:"
|
||||
Write-Host " $zipPath"
|
||||
Reference in New Issue
Block a user