Build script

This commit is contained in:
Marco 2025-02-24 17:17:46 +01:00
commit 101fa7d182
6 changed files with 83 additions and 5 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
# Godot 4+ specific ignores # Godot 4+ specific ignores
.godot/ .godot/
.vscode/ .vscode/
build/** build/**
release/**

View file

@ -3,8 +3,14 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading> <EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="$(GIT_ASSEMBLY_SEM_VER) != ''">
<Version>$(GIT_ASSEMBLY_SEM_VER)</Version>
<AssemblyVersion>$(GIT_ASSEMBLY_SEM_VER)</AssemblyVersion>
<FileVersion>$(GIT_ASSEMBLY_SEM_FILE_VER)</FileVersion>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Content Include="Export.ps1" /> <Content Include="Export.ps1" />
<Content Include="Publish.ps1" />
<Content Include="Scripts\Resources\Events\tsconfig.json" /> <Content Include="Scripts\Resources\Events\tsconfig.json" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -1 +1,42 @@
F:\Apps\Godot_v4.4\Godot_v4.4-rc1_mono_win64.exe --headless --export-release "Windows Desktop" .\build\Cirno_No_Reason.exe # Define paths
$gitVersionPath = "dotnet-gitversion.exe"
$godotPath = "F:\Apps\Godot_v4.4\Godot_v4.4-rc1_mono_win64.exe"
$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
}
# 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"

5
GitVersion.yml Normal file
View file

@ -0,0 +1,5 @@
mode: ContinuousDeployment
branches: {}
ignore:
sha: []
merge-message-formats: {}

25
Publish.ps1 Normal file
View file

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

View file

@ -37,8 +37,8 @@ application/modify_resources=true
application/icon="uid://dicat7qqa0a7o" application/icon="uid://dicat7qqa0a7o"
application/console_wrapper_icon="" application/console_wrapper_icon=""
application/icon_interpolation=4 application/icon_interpolation=4
application/file_version="" application/file_version="0.1.0.0"
application/product_version="" application/product_version="0.1.0.0"
application/company_name="Maddo" application/company_name="Maddo"
application/product_name="Cirno: No Reason" application/product_name="Cirno: No Reason"
application/file_description="" application/file_description=""
@ -66,4 +66,4 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi
Remove-Item -Recurse -Force '{temp_dir}'" Remove-Item -Recurse -Force '{temp_dir}'"
dotnet/include_scripts_content=false dotnet/include_scripts_content=false
dotnet/include_debug_symbols=true dotnet/include_debug_symbols=true
dotnet/embed_build_outputs=false dotnet/embed_build_outputs=true