Add scripts for building and managing RustDesk versions
Some checks failed
rustdesk-auto-build / build-and-publish (push) Has been cancelled
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.
This commit is contained in:
48
scripts/Invoke-RustDeskPipeline.ps1
Normal file
48
scripts/Invoke-RustDeskPipeline.ps1
Normal file
@@ -0,0 +1,48 @@
|
||||
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."
|
||||
Reference in New Issue
Block a user