Some checks failed
rustdesk-auto-build / build-and-publish (push) Has been cancelled
- Implement Build-CustomRustDesk.ps1 to build RustDesk with specified version and configuration. - Create Get-LastBuiltVersion.ps1 to retrieve the last built version from a state file. - Add Get-LatestRustDeskVersion.ps1 to fetch the latest version from GitHub releases. - Develop Invoke-RustDeskPipeline.ps1 to orchestrate the build and deployment process. - Introduce Publish-Artifacts.ps1 for publishing build artifacts via SMB or SCP. - Implement Set-LastBuiltVersion.ps1 to update the state file with the last built version.
40 lines
1.0 KiB
PowerShell
40 lines
1.0 KiB
PowerShell
function Build-CustomRustDesk {
|
|
[CmdletBinding()]
|
|
param(
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$Version,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$ConfigPath,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$OutputDir,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$BuilderCommandTemplate
|
|
)
|
|
|
|
if (-not (Test-Path -LiteralPath $ConfigPath)) {
|
|
throw "Config file not found: $ConfigPath"
|
|
}
|
|
|
|
New-Item -Path $OutputDir -ItemType Directory -Force | Out-Null
|
|
|
|
$resolvedConfig = Resolve-Path -LiteralPath $ConfigPath
|
|
$resolvedOutput = Resolve-Path -LiteralPath $OutputDir
|
|
|
|
$command = $BuilderCommandTemplate
|
|
$command = $command.Replace("{{version}}", $Version)
|
|
$command = $command.Replace("{{config}}", $resolvedConfig.Path)
|
|
$command = $command.Replace("{{output}}", $resolvedOutput.Path)
|
|
|
|
Write-Host "Executing builder command:"
|
|
Write-Host $command
|
|
|
|
Invoke-Expression $command
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Custom builder command failed with exit code $LASTEXITCODE"
|
|
}
|
|
}
|