Files
MrTrust/scripts/New-MrTrustRelease.ps1
MrSphay 93ca15a881
All checks were successful
Build MrTrust / build (push) Successful in 3m49s
Make MrTrust executable standalone
2026-05-16 01:21:52 +02:00

65 lines
1.8 KiB
PowerShell

[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"
$iconPath = Join-Path $root "assets\MrTrust.ico"
if (Test-Path -LiteralPath $packageRoot) {
Remove-Item -LiteralPath $packageRoot -Recurse -Force
}
New-Item -ItemType Directory -Force -Path $packageRoot | Out-Null
if (-not (Test-Path -LiteralPath $iconPath)) {
& (Join-Path $root "scripts\New-MrTrustIcon.ps1") -OutputPath $iconPath
}
& (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 "README.md") -Destination $packageRoot
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"