Files
RustDeskAutomaton/scripts/Invoke-RustDeskPipeline.ps1
Jakub Tucek 472cd9e57c
Some checks failed
rustdesk-auto-build / build-and-publish (push) Has been cancelled
Add scripts for building and managing RustDesk versions
- 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.
2026-03-17 14:20:29 +01:00

49 lines
2.0 KiB
PowerShell

Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
. (Join-Path $scriptDir "Get-LatestRustDeskVersion.ps1")
. (Join-Path $scriptDir "Get-LastBuiltVersion.ps1")
. (Join-Path $scriptDir "Set-LastBuiltVersion.ps1")
. (Join-Path $scriptDir "Build-CustomRustDesk.ps1")
. (Join-Path $scriptDir "Publish-Artifacts.ps1")
$stateFilePath = if ($env:STATE_FILE_PATH) { $env:STATE_FILE_PATH } else { "C:\gitea-runner-state\rustdesk\last-built-version.txt" }
$configPath = if ($env:CONFIG_PATH) { $env:CONFIG_PATH } else { "infernalQS.json" }
$outputDir = if ($env:BUILD_OUTPUT_DIR) { $env:BUILD_OUTPUT_DIR } else { ".\dist" }
$builderCommand = $env:BUILDER_COMMAND
if ([string]::IsNullOrWhiteSpace($builderCommand)) {
throw 'BUILDER_COMMAND is empty. Set it as a Gitea secret. Example: .\\tools\\rdgen-cli.exe build --config "{{config}}" --version "{{version}}" --output "{{output}}"'
}
Write-Host "Resolving latest RustDesk release..."
$latestVersion = Get-LatestRustDeskVersion
Write-Host "Latest version: $latestVersion"
$lastBuiltVersion = Get-LastBuiltVersion -StateFilePath $stateFilePath
if ($lastBuiltVersion) {
Write-Host "Last built version: $lastBuiltVersion"
} else {
Write-Host "No previous built version found."
}
if ($lastBuiltVersion -eq $latestVersion) {
Write-Host "No new version detected. Skipping build."
exit 0
}
Write-Host "New version detected. Running custom builder..."
Build-CustomRustDesk -Version $latestVersion -ConfigPath $configPath -OutputDir $outputDir -BuilderCommandTemplate $builderCommand
# Publish a small marker so humans can quickly check what is deployed.
$versionMarkerPath = Join-Path $outputDir "latest-version.txt"
Set-Content -Path $versionMarkerPath -Value $latestVersion -Encoding Ascii
$deployMode = if ($env:DEPLOY_MODE) { $env:DEPLOY_MODE } else { "smb" }
Publish-Artifacts -OutputDir $outputDir -Mode $deployMode
Set-LastBuiltVersion -StateFilePath $stateFilePath -Version $latestVersion
Write-Host "Pipeline completed successfully."