-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmake_zip.ps1
41 lines (32 loc) · 998 Bytes
/
make_zip.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
param (
[System.Version]$Version = "0.0.0.0",
[string]$Arch = "x64",
[string]$CompanyName = "ONLYOFFICE",
[string]$ProductName = "DocumentBuilder",
[string]$BuildDir = "build"
)
$ErrorActionPreference = "Stop"
Set-Location $PSScriptRoot
if (-not (Test-Path "$BuildDir")) {
Write-Error "Path `"$BuildDir`" does not exist"
}
$ZipFile = "zip\$CompanyName-$ProductName-$Version-$Arch.zip"
Write-Host @"
Version = $Version
Arch = $Arch
CompanyName = $CompanyName
ProductName = $ProductName
BuildDir = $BuildDir
ZipFile = $ZipFile
"@
####
Write-Host "`n[ Create archive ]"
if (Test-Path "$ZipFile") {
Write-Host "DELETE: $ZipFile"
Remove-Item -Force -LiteralPath "$ZipFile"
}
Write-Host "CREATE DIR: zip"
New-Item -ItemType Directory -Force -Path "zip" | Out-Null
Write-Host "7z a -y $ZipFile .\$BuildDir\*"
& 7z a -y "$ZipFile" ".\$BuildDir\*"
if (-not $?) { throw "Exited with code $LastExitCode" }