param ( [switch]$testing, [switch]$release, [switch]$output_test, [switch]$build, [switch]$help ) $script_version = "1.0.1-public" Write-Output "" Write-Host "███████╗██╗ ██╗ ██╗███████╗██████╗ ██████╗ ████████╗" -ForegroundColor DarkCyan Write-Host "██╔════╝██║ ██║ ██║██╔════╝██╔══██╗██╔═══██╗╚══██╔══╝" -ForegroundColor DarkCyan Write-Host "█████╗ ██║ ██║ ██║█████╗ ██████╔╝██║ ██║ ██║ " -ForegroundColor DarkCyan Write-Host "██╔══╝ ██║ ██║ ██║██╔══╝ ██╔══██╗██║ ██║ ██║ " -ForegroundColor DarkCyan Write-Host "███████╗███████╗███████╗██║███████╗██████╔╝╚██████╔╝ ██║ " -ForegroundColor DarkCyan Write-Host "╚══════╝╚══════╝╚══════╝╚═╝╚══════╝╚═════╝ ╚═════╝ ╚═╝ " -ForegroundColor DarkCyan Write-Output "" # If you remove this copyright header I will bonk Write-Output "Copyright © 2024 Toastie_t0ast & EllieBotDevs" Write-Output "" Write-Host "Current script version is v$script_version" -ForegroundColor DarkCyan Write-Output "" if ($release) { if ($args.Length -eq 0) { Write-Host "Please provide a version string." -ForegroundColor Red Write-Output "" Write-Host "Script failed." -ForegroundColor Red Write-Host "Please read the Error above for more information" -ForegroundColor Gray Write-Output "" } else { $version = $args[0] Write-Output "" Write-Host "Publishing EllieBot v$version" -Foregroundcolor Green Write-Output "" Write-Output "" Write-Output "Compiling the linux-x64 build" Write-Output "" dotnet publish -c Release -r linux-x64 --self-contained -o elliebot-linux-x64 src/EllieBot/EllieBot.csproj Write-Output "" Write-Output "Compiling the linux-arm64 build" Write-Output "" dotnet publish -c Release -r linux-arm64 --self-contained -o elliebot-linux-arm64 src/EllieBot/EllieBot.csproj Write-Output "" Write-Output "Compiling the windows-x64 build" Write-Output "" dotnet publish -c Release -r win-x64 --self-contained -o elliebot-windows-x64 src/EllieBot/EllieBot.csproj Write-Output "" Write-Output "Compiling the windows-arm64 build" Write-Output "" dotnet publish -c Release -r win-arm64 --self-contained -o elliebot-windows-arm64 src/EllieBot/EllieBot.csproj Write-Output "" Write-Output "Compiling the osx-x64 build" Write-Output "" dotnet publish -c Release -r osx-x64 --self-contained -o elliebot-osx-x64 src/EllieBot/EllieBot.csproj Write-Output "" Write-Output "Compiling the osx-arm64 build" Write-Output "" dotnet publish -c Release -r osx-arm64 --self-contained -o elliebot-osx-arm64 src/EllieBot/EllieBot.csproj Write-Output "" Write-Output "Preparing the Windows installer build." Write-Output "" dotnet clean dotnet restore -f --no-cache -v n dotnet publish -c Release --self-contained --runtime win-x64 /p:Version="$version" src/EllieBot Write-Output "" Write-Output "Setting environemt variable" Write-Output "" $env:ELLIEBOT_INSTALL_VERSION = $version Write-Output "" Write-Output "Compiling installer file" Write-Output "" iscc.exe /O+ .\exe_builder.iss Write-Output "" Write-Output "Compressing windows build files" Write-Output "" Compress-Archive -Path elliebot-windows-x64/ "$version-windows-x64-build.zip" Compress-Archive -Path elliebot-windows-arm64/ "$version-windows-arm64-build.zip" Write-Output "" Write-Output "Moving the installer file to the directory this script is in" Write-Output "" Move-Item ellie-installers/$version/ellie-setup-$version.exe ellie-setup-$version.exe Write-Output "" Write-Output "Script finished successfully" Write-Output "" Write-Output "If you wish to build the linux or MacOS builds please run" Write-Output "package.sh in wsl if you are on Windows or in bash (or whatever terminal you use) on linux" Write-Output "" Write-Output "If you have any suggestions on how to make this script better please make a suggestion" Write-Output "in our discord @ https://discord.gg/etQdZxSyEH and in the 📚・suggestions channel" Write-Output "" } } if ($testing) { if ($args.Length -eq 0) { Write-Host "Please provide a version string." -ForegroundColor Red Write-Output "" Write-Host "Script failed." -ForegroundColor Red Write-Host "Please read the Error above for more information" -ForegroundColor Gray Write-Output "" } else { $version = $args[0] Write-Output "" Write-Output "Running tests for EllieBot v$version" Write-Output "" dotnet test Write-Output "" Write-Output "Script finished successfully" Write-Output "" Write-Output "If you have any suggestions on how to make this script better please make a suggestion" Write-Output "in our discord @ https://discord.gg/etQdZxSyEH and in the 📚・suggestions channel" Write-Output "" } } if ($output_test) { Write-Output "" Write-Output "Compiling a test build of EllieBot" Write-Output "" dotnet publish -c Release -o output/ src/EllieBot/ Write-Output "" Write-Output "copying creds_example.yml to creds.yml" Write-Output "" Set-Location output Copy-Item creds_example.yml creds.yml Set-Location .. Write-Output "" Write-Output "Script finished successfully" Write-Output "" Write-Output "If you have any suggestions on how to make this script better please make a suggestion" Write-Output "in our discord @ https://discord.gg/etQdZxSyEH and in the 📚・suggestions channel" Write-Output "" } if ($build) { Write-Output "" Write-Output "Restoring EllieBot" Write-Output "" dotnet restore Write-Output "" Write-Output "Building EllieBot" Write-Output "" dotnet build --no-restore -c Release Write-Output "" Write-Output "Script finished successfully" Write-Output "" Write-Output "If you have any suggestions on how to make this script better please make a suggestion" Write-Output "in our discord @ https://discord.gg/etQdZxSyEH and in the 📚・suggestions channel" Write-Output "" } if ($help) { Write-Output "" Write-Output "Here is a list of switches for this script." Write-Output "" Write-Host "Release parameter" -ForegroundColor Green Write-Output "-release" Write-Output "" Write-Host "Testing parameter" -ForegroundColor Blue Write-Output "-testing" Write-Output "" Write-Host "Output test parameter" -ForegroundColor Yellow Write-Output "-output_test" Write-Output "" Write-Host "Build parameter" -ForegroundColor DarkCyan Write-Output "-build" Write-Output "" Write-Host "Here is an example" -ForegroundColor Gray Write-Host "build.ps1 -build" -ForegroundColor Gray Write-Output "" }