forked from Xcone/factorio_pump
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.ps1
25 lines (19 loc) · 910 Bytes
/
make.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
25
$version = (Get-Content ./mod/changelog.txt | Select-String -Pattern "Version:" | Select-Object -First 1).ToString().Split(": ")[2]
$mod = 'pump_' + $version
$stagedir = '.build\' + $mod
$stagedirInfoJson = $stagedir + '\info.json'
$7zipPath = "$env:ProgramFiles\7-Zip\7z.exe"
Write-Output '#Clear the build dir'
Remove-Item -Path .build -Force -Recurse
Write-Output '#Copy content to staging directory'
New-Item -ItemType "directory" -Path $stagedir
Copy-Item mod\* -Destination $stagedir -Recurse
Write-Output '#Apply version'
(Get-Content $stagedirInfoJson).replace('<%version%>', $version) | Set-Content $stagedirInfoJson
Write-Output '#Bundle'
if (-not (Test-Path -Path $7zipPath -PathType Leaf)) {
throw "7 zip file '$7zipPath' not found"
}
& $7zipPath a -tzip ('.build\' + $mod + '.zip') ('.\' + $stagedir)
Write-Output '#Clear staging directory'
Remove-Item -Path $stagedir -Force -Recurse