-
Notifications
You must be signed in to change notification settings - Fork 2
/
buildrelease.ps1
54 lines (44 loc) · 1.7 KB
/
buildrelease.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
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
51
52
53
54
$ErrorActionPreference = "Stop"
Write-Output "Packaging Demo"
# Zip parent folder
Write-Output "Root: $PSScriptRoot"
$zipsrc = (Get-Item $PSScriptRoot).FullName
$foldername = (Get-Item $PSScriptRoot).Name
$zipdst = Join-Path $zipsrc "SudsProExample_INSERTUEVERSION.zip"
Write-Output "Compressing to $zipdst"
$argList = [System.Collections.ArrayList]@()
$argList.Add("a") > $null
$argList.Add($zipdst) > $null
# Standard exclusions
$argList.Add("-x!$foldername\.git\*") > $null
$argList.Add("-x!$foldername\.git*") > $null
$argList.Add("-x!$foldername\.vscode\*") > $null
$argList.Add("-x!$foldername\buildrelease.ps1") > $null
$argList.Add("-x!$foldername\Binaries\*") > $null
$argList.Add("-x!$foldername\Intermediate\*") > $null
$argList.Add("-x!$foldername\DerivedDataCache\*") > $null
$argList.Add("-x!$foldername\Saved\*") > $null
$argList.Add("-x!$foldername\*.zip") > $null
# We include the built plugin but don't need the debug symbols
$argList.Add("-x!*.pdb") > $null
$argList.Add($zipsrc) > $null
Remove-Item $zipdst -Force -ErrorAction SilentlyContinue
$proc = Start-Process "7z.exe" $argList -Wait -PassThru -NoNewWindow
if ($proc.ExitCode -ne 0) {
throw "7-Zip archive failed!"
}
$approvedFolderName = "SudsProExample"
if ($foldername -ne $approvedFolderName)
{
# We now need to rename the root folder inside the zip
$argList = [System.Collections.ArrayList]@()
$argList.Add("rn") > $null
$argList.Add($zipdst) > $null
$argList.Add("$foldername\") > $null
$argList.Add("$approvedFolderName\") > $null
$proc = Start-Process "7z.exe" $argList -Wait -PassThru -NoNewWindow
if ($proc.ExitCode -ne 0) {
throw "7-Zip folder rename failed!"
}
}
Write-Output "Demo packaging OK!"