This repository has been archived on 2026-10-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SashegDev 2eaab88809 Собирать релизный архив и брать профиль из пакета
package-release.ps1 кладёт в zip то, что нужно другу: install/uninstall/
start-launcher, dist с артефактами, profiles, README. Сборка запускается
внутри, чтобы архив всегда соответствовал исходникам.

Установщик теперь сначала смотрит профиль в profiles\latest.rsxp пакета, и
только потом в старый путь с моей машины - раньше друг получил бы
"профиля нет".
2026-10-17 01:49:47 +03:00

81 lines
2.7 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# build a release zip: everything a friend needs to install the modloader
#
# powershell -ExecutionPolicy Bypass -File scripts\package-release.ps1
# powershell -ExecutionPolicy Bypass -File scripts\package-release.ps1 -Version 0.1.1
#
# The zip is a subset of the repo: no sources of the reverse engineering
# tooling, no build scratch, just the installer and the artifacts it installs.
param(
[string]$Version = '0.1.0'
)
$ErrorActionPreference = 'Stop'
$Repo = Split-Path -Parent $PSScriptRoot
function Say($message, $color) {
if ($color) {
Write-Host $message -ForegroundColor $color
} else {
Write-Host $message
}
}
$name = "rsx-modloader-$Version"
$stage = Join-Path $Repo "build\$name"
$zip = Join-Path $Repo "dist\$name.zip"
Say 'Собираю артефакты...'
& (Join-Path $PSScriptRoot 'build.ps1')
if ($LASTEXITCODE -ne 0) {
Say ' сборка не удалась.' Red
exit 1
}
Say ''
Say 'Собираю пакет...'
Remove-Item $stage -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $zip -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Force -Path $stage | Out-Null
# the entrypoints a friend actually clicks
foreach ($file in 'install.cmd', 'uninstall.cmd', 'start-launcher.cmd', 'build.cmd') {
$src = Join-Path $Repo $file
if (Test-Path $src) {
Copy-Item $src (Join-Path $stage $file) -Force
}
}
foreach ($dir in 'dist', 'profiles') {
$src = Join-Path $Repo $dir
if (Test-Path $src) {
Copy-Item $src (Join-Path $stage $dir) -Recurse -Force
}
}
foreach ($file in 'README.md', 'LICENSE', 'AUTHORS.md') {
$src = Join-Path $Repo $file
if (Test-Path $src) {
Copy-Item $src (Join-Path $stage $file) -Force
}
}
# the .cmd entrypoints call scripts\*.ps1, so keep that layout inside the zip
New-Item -ItemType Directory -Force -Path (Join-Path $stage 'scripts') | Out-Null
Copy-Item (Join-Path $PSScriptRoot 'install.ps1') (Join-Path $stage 'scripts\install.ps1') -Force
Copy-Item (Join-Path $PSScriptRoot 'start-launcher.ps1') (Join-Path $stage 'scripts\start-launcher.ps1') -Force
# build scratch must never end up in a release
Get-ChildItem $stage -Recurse -Include '*.new', '*.orig', '*.class' -File |
ForEach-Object { Remove-Item $_.FullName -Force -ErrorAction SilentlyContinue }
Say ''
Say 'Жму zip...'
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::CreateFromDirectory(
$stage, $zip, [System.IO.Compression.CompressionLevel]::Optimal, $false)
$size = [math]::Round((Get-Item $zip).Length / 1MB, 2)
Say ''
Say "Готово: dist\$name.zip ($size МБ)" Green
Say ''
Say 'В архиве:'
Get-ChildItem $stage | ForEach-Object { Say " $($_.Name)" }