forked from Insprill/dv-multiplayer
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathpost-build.ps1
More file actions
50 lines (41 loc) · 1.3 KB
/
Copy pathpost-build.ps1
File metadata and controls
50 lines (41 loc) · 1.3 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
param
(
[switch]$NoArchive,
[string]$GameDir,
[string]$Target,
[string]$Ver
)
Write-Host "Root: $PSScriptRoot"
Write-Host "No Archive: $NoArchive"
Write-Host "Target: $Target"
Write-Host "Game Dir: $GameDir"
Write-Host "Version: $Ver"
$compress
#Update the JSON
$json = Get-Content ($PSScriptRoot + '/info.json') -raw | ConvertFrom-Json
$json.Version = $Ver
$modId = $json.Id
$json | ConvertTo-Json -depth 32| set-content ($PSScriptRoot + '/info.json')
#Copy files to Build Dir
Copy-Item ($PSScriptRoot + '/info.json') -Destination ("$PSScriptRoot/build/")
Copy-Item ($Target) -Destination ("$PSScriptRoot/build/")
Copy-Item ($PSScriptRoot + '/LICENSE') -Destination ("$PSScriptRoot/build/")
#Copy files to Game Dir
if (!(Test-Path ($GameDir))) {
New-Item -ItemType Directory -Path $GameDir
}
Copy-Item ("$PSScriptRoot/build/*") -Destination ($GameDir)
#Files to be compressed if we make a zip
$compress = @{
Path = ($PSScriptRoot + "/build/*")
CompressionLevel = "Fastest"
DestinationPath = ($PSScriptRoot + "/Releases/$modId $Ver.zip")
}
#Are we building a release or debug?
if (!$NoArchive){
if (!(Test-Path ($PSScriptRoot + "/releases"))) {
New-Item -ItemType Directory -Path ($PSScriptRoot + "/releases")
}
Write-Host "Zip Path: " $compress.DestinationPath
Compress-Archive @compress -Force
}