Build tweaks

This commit is contained in:
Marco 2025-05-03 16:48:24 +02:00
commit 40179c193d
5 changed files with 93 additions and 10 deletions

View file

@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.4.0">
<Project Sdk="Godot.NET.Sdk/4.4.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>

47
Export-linux.ps1 Normal file
View file

@ -0,0 +1,47 @@
# Define paths
$gitVersionPath = "dotnet-gitversion.exe"
$godotPath = $env:GODOT
$buildDir = ".\build"
$configFile = "export_presets.cfg"
$zipOutputDir = ".\release"
$fileName = "Cirno_No_Reason"
# Step 1: Clear the build directory
if (Test-Path $buildDir) {
Remove-Item "$buildDir\*" -Recurse -Force
} else {
New-Item -ItemType Directory -Path $buildDir | Out-Null
}
New-Item -ItemType Directory -Path $buildDir\win | Out-Null
New-Item -ItemType Directory -Path $buildDir\linux | Out-Null
# Step 2: Get version data from GitVersion
$gitVersionOutput = & $gitVersionPath | ConvertFrom-Json
$assemblySemFileVer = $gitVersionOutput.AssemblySemFileVer
$assemblySemVer = $gitVersionOutput.AssemblySemVer
$fullSemVer = $gitVersionOutput.FullSemVer
# Step 3: Set environment variables for use in the build process
[System.Environment]::SetEnvironmentVariable("GIT_ASSEMBLY_SEM_FILE_VER", $assemblySemFileVer, [System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable("GIT_ASSEMBLY_SEM_VER", $assemblySemVer, [System.EnvironmentVariableTarget]::Process)
Write-Host "Set environment variables:"
Write-Host " GIT_ASSEMBLY_SEM_FILE_VER = $assemblySemFileVer"
Write-Host " GIT_ASSEMBLY_SEM_VER = $assemblySemVer"
# Step 3: Update export_presets.cfg
if (Test-Path $configFile) {
(Get-Content $configFile) `
-replace 'application/file_version="[^"]*"', "application/file_version=`"$assemblySemFileVer`"" `
-replace 'application/product_version="[^"]*"', "application/product_version=`"$assemblySemVer`"" `
| Set-Content $configFile
} else {
Write-Host "Warning: $configFile not found!"
}
# Step 4: Export the build
#& $godotPath --headless --export-release "Windows Desktop" "$buildDir\$fileName.exe"
#& $godotPath --headless --export-release "Windows Desktop" "$buildDir\win\$fileName.exe"
& $godotPath --headless --export-release "Linux" "$buildDir\linux\$fileName.x86_64"

View file

@ -11,10 +11,11 @@ if (Test-Path $buildDir) {
Remove-Item "$buildDir\*" -Recurse -Force
} else {
New-Item -ItemType Directory -Path $buildDir | Out-Null
New-Item -ItemType Directory -Path $buildDir\win | Out-Null
New-Item -ItemType Directory -Path $buildDir\linux | Out-Null
}
New-Item -ItemType Directory -Path $buildDir\win | Out-Null
New-Item -ItemType Directory -Path $buildDir\linux | Out-Null
# Step 2: Get version data from GitVersion
$gitVersionOutput = & $gitVersionPath | ConvertFrom-Json
$assemblySemFileVer = $gitVersionOutput.AssemblySemFileVer
@ -41,6 +42,6 @@ if (Test-Path $configFile) {
# Step 4: Export the build
#& $godotPath --headless --export-release "Windows Desktop" "$buildDir\$fileName.exe"
& $godotPath --headless --export-release "Windows Desktop" "$buildDir\win\$fileName.x86_64"
& $godotPath --headless --export-release "Windows Desktop" "$buildDir\win\$fileName.exe"
& $godotPath --headless --export-release "Linux" "$buildDir\linux\$fileName"
#& $godotPath --headless --export-release "Linux" "$buildDir\linux\$fileName.x86_64"

34
Publish-linux.ps1 Normal file
View file

@ -0,0 +1,34 @@
$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
$zipFileName = "$fileName.$fullSemVer.win.zip"
$zipFileNameLinux = "$fileName.$fullSemVer.linux.zip"
$zipFilePath = "$zipOutputDir\$zipFileName"
$zipFilePathLinux = "$zipOutputDir\$zipFileNameLinux"
# Zip the build folder
if (!(Test-Path $zipOutputDir)) {
New-Item -ItemType Directory -Path $zipOutputDir | Out-Null
}
#Compress-Archive -Path "$buildDir\win\*" -DestinationPath $zipFilePath -Force
#Compress-Archive -Path "$buildDir\*" -DestinationPath $zipFilePath -Force
#Write-Host "Windows Build completed and packaged as $zipFilePath"
Compress-Archive -Path "$buildDir\linux\*" -DestinationPath $zipFilePathLinux -Force
Write-Host "Linux Build completed and packaged as $zipFilePathLinux"
#& $butlerPath push $zipFilePath maddoscientisto/cirno-no-reason:windows$PreReleaseLabel --userversion $fullSemVer
& $butlerPath push $zipFilePathLinux maddoscientisto/cirno-no-reason:linux$PreReleaseLabel --userversion $fullSemVer

View file

@ -10,23 +10,24 @@ $assemblySemVer = $gitVersionOutput.AssemblySemVer
$fullSemVer = $gitVersionOutput.FullSemVer
$PreReleaseLabel = $gitVersionOutput.PreReleaseLabelWithDash
$zipFileName = "$fileName.$fullSemVer.zip"
$zipFileName = "$fileName.$fullSemVer.win.zip"
$zipFileNameLinux = "$fileName.$fullSemVer.linux.zip"
$zipFilePath = "$zipOutputDir\$zipFileName"
$zipFilePathLinux = "$zipOutputDir\$zipFileName"
$zipFilePathLinux = "$zipOutputDir\$zipFileNameLinux"
# Zip the build folder
if (!(Test-Path $zipOutputDir)) {
New-Item -ItemType Directory -Path $zipOutputDir | Out-Null
}
#Compress-Archive -Path "$buildDir\win\*" -DestinationPath $zipFilePath -Force
Compress-Archive -Path "$buildDir\*" -DestinationPath $zipFilePath -Force
Compress-Archive -Path "$buildDir\win\*" -DestinationPath $zipFilePath -Force
#Compress-Archive -Path "$buildDir\*" -DestinationPath $zipFilePath -Force
Write-Host "Windows Build completed and packaged as $zipFilePath"
#Compress-Archive -Path "$buildDir\linux\*" -DestinationPath $zipFilePathLinux -Force
Write-Host "Linux Build completed and packaged as $zipFilePathLinux"
#Write-Host "Linux Build completed and packaged as $zipFilePathLinux"
& $butlerPath push $zipFilePath maddoscientisto/cirno-no-reason:windows$PreReleaseLabel --userversion $fullSemVer