-
Notifications
You must be signed in to change notification settings - Fork 3
/
pack-rando.ps1
24 lines (21 loc) · 1.09 KB
/
pack-rando.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
param (
[switch] $Release = $False
)
$ScriptsFolder = "$PSScriptRoot\Scripts"
$RandoFolderName = 'Entrance Randomizer'
$VersionFilePath = "$ScriptsFolder\$RandoFolderName/lib/constants.py"
Remove-Item -Path $ScriptsFolder -Recurse -ErrorAction SilentlyContinue
Copy-Item -Path "$PSScriptRoot\$RandoFolderName" -Destination "$ScriptsFolder\$RandoFolderName" -Recurse
Copy-Item -Path "$PSScriptRoot\..\Various technical notes\transition_infos.json" -Destination "$ScriptsFolder\$RandoFolderName\lib"
$VersionFileContent = Get-Content $VersionFilePath
$VersionLine = $VersionFileContent | Select-String -Pattern '^__version\s*=\s*".*"'
$RandoVersion = $VersionLine -replace '^\s*__version\s*=\s*"', '' -replace '".*$', ''
if ($Release) {
$DevVersion = ''
}
else {
$DevVersion = "-$(git rev-parse --short HEAD)"
}
$VersionFileContent -replace '^\s*__dev_version.*', "__dev_version = `"$DevVersion`"" | Set-Content $VersionFilePath
Compress-Archive -Path $ScriptsFolder -DestinationPath "$RandoFolderName v$RandoVersion$DevVersion.zip" -Force
Remove-Item -Path $ScriptsFolder -Recurse -ErrorAction SilentlyContinue