2018-07-27 03:53:35 +02:00
|
|
|
|
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";
|
2018-02-20 04:27:43 +01:00
|
|
|
|
$chocoDir = $rootDir + "\stores\chocolatey";
|
|
|
|
|
$distChocoDir = $distDir + "\chocolatey";
|
|
|
|
|
|
|
|
|
|
if(Test-Path -Path $distChocoDir) {
|
|
|
|
|
Remove-Item -Recurse -Force $distChocoDir
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Copy-Item -Path $chocoDir -Destination $distChocoDir –Recurse
|
|
|
|
|
|
2018-07-27 03:53:35 +02:00
|
|
|
|
$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
|
|
|
|
|
2018-02-20 04:27:43 +01:00
|
|
|
|
$checksum = checksum -t sha256 $exe
|
|
|
|
|
$nuspec = $distChocoDir + "\bitwarden.nuspec";
|
|
|
|
|
$chocoInstall = $distChocoDir + "\tools\chocolateyinstall.ps1";
|
|
|
|
|
|
2018-07-27 03:53:35 +02:00
|
|
|
|
(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
|
2021-01-22 05:53:28 +01:00
|
|
|
|
choco push
|
2018-06-04 21:36:56 +02:00
|
|
|
|
cd $rootDir
|