0
0
mirror of https://github.com/sp-tarkov/build.git synced 2025-02-13 09:50:45 -05:00
build/project/build.ps1
Refringe 73dad7e3be
Changes:
- Updates Drone pipeline with initial version that may or may not work.
- All three project repositories are checked to see if the tag exists before the builds take place.
- Additional static project files are now added into the release directory (release is now whole)
- The release directory is being compressed into a ZIP file using the Deflate algorithm (compatibility) with maximum compression.

TODO:
- Needs major testing within a Drone pipeline--Probably doesn't work at all right now.
- Adapt build script to work with a dynamic tag value.
- Upload release to public folder.
2024-02-27 18:05:43 -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 ""