bitwarden-estensione-browser/apps/desktop/scripts/safari-build.ps1

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
1.6 KiB
PowerShell
Raw Permalink Normal View History

2019-08-26 20:26:23 +02:00
param (
2019-10-02 15:32:46 +02:00
[string] $version,
[switch] $mas,
2020-09-22 23:28:09 +02:00
[switch] $masdev,
2020-09-24 16:20:56 +02:00
[switch] $skipcheckout,
2020-09-24 18:17:41 +02:00
[switch] $skipoutcopy,
[switch] $copyonly
2019-08-26 20:26:23 +02:00
)
# Dependencies:
# 1. brew cask install powershell
#
# To run:
# pwsh ./build-safari-appex.ps1 -version 1.41.0
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
$rootDir = $dir + "\..";
2020-09-24 19:01:50 +02:00
$distSafariDir = $rootDir + "\dist-safari";
2019-10-01 23:29:52 +02:00
$distSafariAppexDmg = $distSafariDir + "\browser\dist\Safari\dmg\build\Release\safari.appex";
$distSafariAppexMas = $distSafariDir + "\browser\dist\Safari\mas\build\Release\safari.appex";
2019-10-02 15:32:46 +02:00
$distSafariAppexMasDev = $distSafariDir + "\browser\dist\Safari\masdev\build\Release\safari.appex";
2019-08-26 20:26:23 +02:00
$pluginsAppex = $rootDir + "\PlugIns\safari.appex";
2020-09-24 18:17:41 +02:00
function CopyOutput {
if ($mas) {
Copy-Item -Path $distSafariAppexMas -Destination $pluginsAppex Recurse
}
elseif ($masdev) {
Copy-Item -Path $distSafariAppexMasDev -Destination $pluginsAppex Recurse
}
else {
Copy-Item -Path $distSafariAppexDmg -Destination $pluginsAppex Recurse
}
}
2019-10-02 15:32:46 +02:00
if (Test-Path -Path $pluginsAppex) {
2019-08-26 21:24:25 +02:00
Remove-Item -Recurse -Force $pluginsAppex
}
2020-09-24 18:17:41 +02:00
if ($copyonly) {
CopyOutput
exit
}
2020-09-22 23:28:09 +02:00
if(-not $skipcheckout) {
if (Test-Path -Path $distSafariDir) {
Remove-Item -Recurse -Force $distSafariDir
}
New-Item $distSafariDir -ItemType Directory -ea 0
2020-09-22 23:36:17 +02:00
}
cd $distSafariDir
if(-not $skipcheckout) {
2020-09-22 23:28:09 +02:00
git clone git@github.com:bitwarden/browser.git
}
2019-08-26 21:24:25 +02:00
2020-09-22 23:36:17 +02:00
cd browser
2019-10-02 15:32:46 +02:00
if (-not ([string]::IsNullOrEmpty($version))) {
2019-08-26 21:24:25 +02:00
$tag = "v" + $version
git checkout tags/$tag
}
2019-08-26 20:26:23 +02:00
npm i
2020-09-24 16:20:56 +02:00
npm run dist:safari
if (-not $skipoutcopy) {
2020-09-24 18:17:41 +02:00
CopyOutput
2019-10-01 23:29:52 +02:00
}
2020-09-24 16:20:56 +02:00
2019-08-26 20:26:23 +02:00
cd $rootDir