mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 03:35:54 +00:00
New export and publish scripts
This commit is contained in:
parent
01e61cb685
commit
881a4897da
4 changed files with 37 additions and 100 deletions
|
|
@ -1,47 +0,0 @@
|
|||
# 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"
|
||||
13
Export.ps1
13
Export.ps1
|
|
@ -41,7 +41,14 @@ 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.exe"
|
||||
#& $godotPath --headless --export-release "Windows Desktop" "$buildDir\win\$fileName.exe"
|
||||
|
||||
#& $godotPath --headless --export-release "Linux" "$buildDir\linux\$fileName.x86_64"
|
||||
#& $godotPath --headless --export-release "Linux" "$buildDir\linux\$fileName.x86_64"
|
||||
|
||||
# Step 4: Export the Windows build via CMD in the same window
|
||||
$winExportCmd = "`"$godotPath`" --headless --export-release `"Windows Desktop`" `"$buildDir\win\$fileName.exe`""
|
||||
& cmd.exe /c $winExportCmd
|
||||
|
||||
# Step 5: Export the Linux build via CMD in the same window
|
||||
$linuxExportCmd = "`"$godotPath`" --headless --export-release `"Linux`" `"$buildDir\linux\$fileName.x86_64`""
|
||||
& cmd.exe /c $linuxExportCmd
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
$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
|
||||
39
Publish.ps1
39
Publish.ps1
|
|
@ -10,25 +10,36 @@ $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"
|
||||
#$zipFileName = "$fileName.$fullSemVer.win.zip"
|
||||
#$zipFileNameLinux = "$fileName.$fullSemVer.linux.zip"
|
||||
#$zipFilePath = "$zipOutputDir\$zipFileName"
|
||||
#$zipFilePathLinux = "$zipOutputDir\$zipFileNameLinux"
|
||||
|
||||
# Zip the build folder
|
||||
# Ensure output directory exists
|
||||
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
|
||||
function Handle-BuildArtifact {
|
||||
param (
|
||||
[string]$platform,
|
||||
[string]$label
|
||||
)
|
||||
|
||||
Write-Host "Windows Build completed and packaged as $zipFilePath"
|
||||
$sourcePath = Join-Path $buildDir $platform
|
||||
$zipFileName = "$fileName.$fullSemVer.$platform.zip"
|
||||
$zipFilePath = Join-Path $zipOutputDir $zipFileName
|
||||
$butlerTarget = "maddoscientisto/cirno-no-reason:$platform$label"
|
||||
|
||||
#Compress-Archive -Path "$buildDir\linux\*" -DestinationPath $zipFilePathLinux -Force
|
||||
$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"
|
||||
}
|
||||
}
|
||||
|
||||
#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
|
||||
Handle-BuildArtifact -platform "win" -label $PreReleaseLabel
|
||||
Handle-BuildArtifact -platform "linux" -label $PreReleaseLabel
|
||||
Loading…
Add table
Add a link
Reference in a new issue