0
0
mirror of https://github.com/sp-tarkov/build.git synced 2025-02-13 05:50:46 -05:00
build/project/build.ps1
Refringe f0f5c03787
Updates Drone Pipeline
- Updates the drone pipeline to actually work. Sorry about the update spam in Discord. >:{}
- Updates the build script to exit gracefully when complete.
2024-02-27 23:27:50 -05:00

64 lines
4.5 KiB
PowerShell
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## Orchestrate the build process for the SPT project
# Get the current directory
$DIR_ABS = (Get-Location).Path
# One art, please...
pwsh $DIR_ABS\project\header.ps1
# Function that pretends the date/time to the start of a log
function Write-Log {
Param(
[string]$Message
)
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Write-Output "[$timestamp] $Message"
}
Write-Log "✅ Beginning SPT Build Process"
Write-Output ""
# Check for the required MODULE_DOMAIN environment variable
$MODULE_DOMAIN = $env:MODULE_DOMAIN
$MODULE_DOMAIN_REGEX = '^(https?:\/\/)?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}(\/)?$'
if ([string]::IsNullOrWhiteSpace($MODULE_DOMAIN) -or -not $MODULE_DOMAIN -match $MODULE_DOMAIN_REGEX -or $MODULE_DOMAIN.EndsWith("/")) {
Write-Log " ❌ FAIL: The MODULE_DOMAIN environment variable is invalid."
exit 1 # Fail the build
}
# TODO: Make dynamic, based on the commit information
$RELEASE_TAG = "3.8.0-BE"
# Validate that the tag exists in all three repositories before continuing the build.
$VALIDATE = Start-Process pwsh -ArgumentList "-File `"$DIR_ABS\project\tag_validate.ps1`" $RELEASE_TAG" -Wait -PassThru -NoNewWindow
if ($VALIDATE.ExitCode -ne 0) {
exit $VALIDATE.ExitCode
}
# Build the Server project
$SERVER = Start-Process pwsh -ArgumentList "-File `"$DIR_ABS\project\build_server.ps1`" $RELEASE_TAG" -Wait -PassThru -NoNewWindow
if ($SERVER.ExitCode -ne 0) {
exit $SERVER.ExitCode
}
# Build the Modules project
$MODULES = Start-Process pwsh -ArgumentList "-File `"$DIR_ABS\project\build_modules.ps1`" $RELEASE_TAG $MODULE_DOMAIN" -Wait -PassThru -NoNewWindow
if ($MODULES.ExitCode -ne 0) {
exit $MODULES.ExitCode
}
# Build the Launcher project
$LAUNCHER = Start-Process pwsh -ArgumentList "-File `"$DIR_ABS\project\build_launcher.ps1`" $RELEASE_TAG" -Wait -PassThru -NoNewWindow
if ($LAUNCHER.ExitCode -ne 0) {
exit $LAUNCHER.ExitCode
}
# Combine built and static files into the release directory
$COMBINE = Start-Process pwsh -ArgumentList "-File `"$DIR_ABS\project\combine.ps1`"" -Wait -PassThru -NoNewWindow
if ($COMBINE.ExitCode -ne 0) {
exit $COMBINE.ExitCode
}
Write-Log "⚡ SPT Build Complete ⚡"
Write-Output ""
exit 0