diff --git a/Cirno.csproj b/Cirno.csproj index ff0cdeff..afde3cb6 100644 --- a/Cirno.csproj +++ b/Cirno.csproj @@ -1,4 +1,4 @@ - + net8.0 true diff --git a/Export-linux.ps1 b/Export-linux.ps1 new file mode 100644 index 00000000..150c13f6 --- /dev/null +++ b/Export-linux.ps1 @@ -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" \ No newline at end of file diff --git a/Export.ps1 b/Export.ps1 index 06250327..1df5aef2 100644 --- a/Export.ps1 +++ b/Export.ps1 @@ -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" \ No newline at end of file +#& $godotPath --headless --export-release "Linux" "$buildDir\linux\$fileName.x86_64" \ No newline at end of file diff --git a/Publish-linux.ps1 b/Publish-linux.ps1 new file mode 100644 index 00000000..ee68e902 --- /dev/null +++ b/Publish-linux.ps1 @@ -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 \ No newline at end of file diff --git a/Publish.ps1 b/Publish.ps1 index b733384e..c93c9233 100644 --- a/Publish.ps1 +++ b/Publish.ps1 @@ -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