1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-30 13:03:53 +01:00
bitwarden-browser/scripts/choco-update.ps1

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

35 lines
1.1 KiB
PowerShell
Raw Normal View History

param (
[Parameter(Mandatory=$true)]
[string] $version
)
# To run:
# .\choco-update.ps1 -version 1.3.0
2018-04-20 02:28:35 +02:00
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
2018-02-20 03:56:46 +01:00
$rootDir = $dir + "\..";
$distDir = $rootDir + "\dist";
$chocoDir = $rootDir + "\stores\chocolatey";
$distChocoDir = $distDir + "\chocolatey";
if(Test-Path -Path $distChocoDir) {
Remove-Item -Recurse -Force $distChocoDir
}
Copy-Item -Path $chocoDir -Destination $distChocoDir Recurse
$exe = $distChocoDir + "\Bitwarden-Installer-" + $version + ".exe";
$uri = "https://github.com/bitwarden/desktop/releases/download/v" + $version + "/Bitwarden-Installer-" + $version + ".exe";
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-RestMethod -Uri $uri -OutFile $exe
2018-02-20 03:56:46 +01:00
$checksum = checksum -t sha256 $exe
$nuspec = $distChocoDir + "\bitwarden.nuspec";
$chocoInstall = $distChocoDir + "\tools\chocolateyinstall.ps1";
(Get-Content $chocoInstall).replace('__version__', $version).replace('__checksum__', $checksum) | Set-Content $chocoInstall
choco pack $nuspec --version $version --out $distChocoDir
2018-06-04 21:36:56 +02:00
cd $distChocoDir
choco push
cd $rootDir