forked from salarcode/SmartProxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-and-pack.ps1
50 lines (41 loc) · 1.44 KB
/
build-and-pack.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
# use PowerShell 7 or later for correct zip file format
# run this in powershell to enable scripts
# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
$global:Success = $true
$global:version = ""
Write-Output "Creating Browser Markets Release Packs..."
Function BuildAndPack($Build, $BuildName) {
if(!$global:Success) {
return;
}
Write-Output "Cleaning build folder"
Remove-Item -path .\build\* -recurse
Invoke-Expression ("npm run build-$Build " + ';$global:Success=$?')
if($global:Success)
{
$manifest = Get-Content .\build\manifest.json | ConvertFrom-Json
$global:version = $manifest.version
if (!(Test-Path "..\!Releases\$global:version\")) {
New-Item -Path "..\!Releases\$global:version\" -ItemType Directory
}
$zipfile = "..\!Releases\$global:version\SmartProxy-v$global:version-$BuildName.zip"
$compress = @{
Path = ".\build\*"
DestinationPath = $zipfile
}
Compress-Archive @compress
Write-Output "Created release in $zipfile"
}
else
{
Write-Output "Build has failed for $BuildName"
}
}
BuildAndPack "ff" "Firefox"
BuildAndPack "ch" "Chrome-ManifestV3"
BuildAndPack "ed" "Edge"
BuildAndPack "th" "Thunderbird"
BuildAndPack "op" "Opera"
BuildAndPack "ff-unlisted" "firefox-unlisted"
Invoke-Expression ("git archive --format zip -o ..\!Releases\$global:version\SmartProxy-$global:version-sources.zip HEAD")
Write-Output "Sources are saved in SmartProxy-$global:version-sources.zip"