diff --git a/Export-linux.ps1 b/Export-linux.ps1 deleted file mode 100644 index 150c13f6..00000000 --- a/Export-linux.ps1 +++ /dev/null @@ -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" \ No newline at end of file diff --git a/Export.ps1 b/Export.ps1 index 1df5aef2..92ee738d 100644 --- a/Export.ps1 +++ b/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" \ No newline at end of file +#& $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 \ No newline at end of file diff --git a/Publish-linux.ps1 b/Publish-linux.ps1 deleted file mode 100644 index ee68e902..00000000 --- a/Publish-linux.ps1 +++ /dev/null @@ -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 \ No newline at end of file diff --git a/Publish.ps1 b/Publish.ps1 index c93c9233..3e146083 100644 --- a/Publish.ps1 +++ b/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 \ No newline at end of file +Handle-BuildArtifact -platform "win" -label $PreReleaseLabel +Handle-BuildArtifact -platform "linux" -label $PreReleaseLabel \ No newline at end of file