cirnogodot/Publish.ps1

45 lines
1.6 KiB
PowerShell
Raw Normal View History

2025-02-24 17:17:46 +01:00
$butlerPath = "F:\Apps\butler\butler.exe"
$zipOutputDir = ".\release"
$fileName = "Cirno_No_Reason"
$gitVersionPath = "dotnet-gitversion.exe"
$buildDir = ".\build"
$gitVersionOutput = & $gitVersionPath | ConvertFrom-Json
$assemblySemFileVer = $gitVersionOutput.AssemblySemFileVer
$assemblySemVer = $gitVersionOutput.AssemblySemVer
$fullSemVer = $gitVersionOutput.FullSemVer
$PreReleaseLabel = $gitVersionOutput.PreReleaseLabelWithDash
2025-05-09 10:18:40 +02:00
#$zipFileName = "$fileName.$fullSemVer.win.zip"
#$zipFileNameLinux = "$fileName.$fullSemVer.linux.zip"
#$zipFilePath = "$zipOutputDir\$zipFileName"
#$zipFilePathLinux = "$zipOutputDir\$zipFileNameLinux"
2025-02-24 17:17:46 +01:00
2025-05-09 10:18:40 +02:00
# Ensure output directory exists
2025-02-24 17:17:46 +01:00
if (!(Test-Path $zipOutputDir)) {
New-Item -ItemType Directory -Path $zipOutputDir | Out-Null
}
2025-05-09 10:18:40 +02:00
function Handle-BuildArtifact {
param (
[string]$platform,
[string]$label
)
$sourcePath = Join-Path $buildDir $platform
$zipFileName = "$fileName.$fullSemVer.$platform.zip"
$zipFilePath = Join-Path $zipOutputDir $zipFileName
$butlerTarget = "maddoscientisto/cirno-no-reason:$platform$label"
$files = Get-ChildItem -Path $sourcePath -Recurse -File -ErrorAction SilentlyContinue
if ($files) {
Compress-Archive -Path "$sourcePath\*" -DestinationPath $zipFilePath -Force
Write-Host "$platform build completed and packaged as $zipFilePath"
& $butlerPath push $zipFilePath $butlerTarget --userversion $fullSemVer
} else {
Write-Warning "$platform build folder is empty or missing: $sourcePath"
}
}
2025-04-26 17:07:43 +02:00
2025-05-09 10:18:40 +02:00
Handle-BuildArtifact -platform "win" -label $PreReleaseLabel
Handle-BuildArtifact -platform "linux" -label $PreReleaseLabel