valentina/scripts/appveyor-deploy.ps1

57 lines
2.5 KiB
PowerShell
Raw Permalink Normal View History

2024-04-27 08:06:27 +02:00
$INSTALL_ROOT = "$env:VALENTINA_BUILD_FOLDER\install-root\valentina";
2021-05-03 16:32:50 +02:00
$type = "$env:TARGET_PLATFORM-$env:COMPILER-$env:ARCH-$env:QT_VERSION-$env:APPVEYOR_REPO_BRANCH-$env:APPVEYOR_REPO_COMMIT";
$file_name = "valentina-${type}.exe";
$portable_file_name = "valentina-portable-${type}.7z";
2021-05-03 14:04:58 +02:00
if($env:DEPLOY -eq "true") {
2024-04-27 08:06:27 +02:00
Write-Host "[CI] Checking installer." -ForegroundColor Green;
$installerPath = "$INSTALL_ROOT\ValentinaInstaller.exe";
2024-01-25 10:32:13 +01:00
if (-not (Test-Path $installerPath)) {
Write-Error -Message "[CI] Installer file not found at $installerPath" -Category InvalidResult;
2021-05-03 14:14:00 +02:00
exit 1;
}
2021-05-03 14:04:58 +02:00
2023-03-11 12:55:40 +01:00
Write-Host "[CI] Starting cleaning." -ForegroundColor Green;
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" clean $env:ACCESS_TOKEN;
if ($LastExitCode -ne 0) {
Write-Error -Message "[CI] Error cleaning stale artifacts." -Category InvalidResult;
exit 1;
} else {
Write-Host "[CI] Cleaning done." -ForegroundColor Green;
}
Write-Host "[CI] Uploading installer." -ForegroundColor Green;
2024-04-27 08:06:27 +02:00
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" upload $env:ACCESS_TOKEN "$INSTALL_ROOT\ValentinaInstaller.exe" "/0.7.x/Windows/$file_name";
2021-05-03 14:14:00 +02:00
if ($LastExitCode -ne 0) {
Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult;
exit 1;
} else {
Write-Host "[CI] Uploading has been finished." -ForegroundColor Green;
}
Write-Host "[CI] Starting packing." -ForegroundColor Green;
2024-04-27 08:06:27 +02:00
Remove-Item -Path "$INSTALL_ROOT\ValentinaInstaller.exe";
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" pack "$INSTALL_ROOT" "$env:VALENTINA_BUILD_FOLDER\install-root\$portable_file_name";
if ($LastExitCode -ne 0) {
Write-Error -Message "[CI] Error creating an archive." -Category InvalidResult;
exit 1;
} else {
Write-Host "[CI] Done." -ForegroundColor Green;
}
Write-Host "[CI] Uploading portable bundle." -ForegroundColor Green;
2024-04-27 08:06:27 +02:00
& $env:PYTHON\python.exe "$env:APPVEYOR_BUILD_FOLDER\scripts\deploy.py" upload $env:ACCESS_TOKEN "$env:VALENTINA_BUILD_FOLDER\install-root\$portable_file_name" "/0.7.x/Windows/$portable_file_name";
if ($LastExitCode -ne 0) {
Write-Error -Message "[CI] Error uploading an artifact." -Category InvalidResult;
exit 1;
} else {
Write-Host "[CI] Uploading has been finished." -ForegroundColor Green;
}
2021-05-03 14:04:58 +02:00
Exit 0;
}
else {
Write-Host "[CI] No deployment needed." -ForegroundColor Green;
Exit 0;
}