2018-06-04 22:59:57 +02:00
|
|
|
|
param (
|
2018-08-09 16:12:35 +02:00
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
|
|
|
[string] $version
|
2018-06-04 22:59:57 +02:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# To run:
|
2018-08-09 16:12:35 +02:00
|
|
|
|
# .\choco-update.ps1 -version 1.3.0
|
2018-05-23 20:42:46 +02:00
|
|
|
|
|
|
|
|
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
|
|
|
|
$rootDir = $dir + "\..";
|
|
|
|
|
$distDir = $rootDir + "\dist";
|
|
|
|
|
$distChocoDir = $distDir + "\chocolatey";
|
|
|
|
|
|
|
|
|
|
if(Test-Path -Path $distChocoDir) {
|
|
|
|
|
Remove-Item -Recurse -Force $distChocoDir
|
|
|
|
|
}
|
2018-08-09 16:12:35 +02:00
|
|
|
|
New-Item -ItemType directory -Path $distChocoDir | Out-Null
|
2018-05-23 20:42:46 +02:00
|
|
|
|
|
2018-08-09 16:12:35 +02:00
|
|
|
|
$nupkg = "bitwarden-cli." + $version + ".nupkg"
|
|
|
|
|
$uri = "https://github.com/bitwarden/cli/releases/download/v" + $version + "/" + $nupkg;
|
|
|
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
|
Invoke-RestMethod -Uri $uri -OutFile $($distChocoDir + "\" + $nupkg)
|
2018-05-23 20:42:46 +02:00
|
|
|
|
|
2018-08-09 16:12:35 +02:00
|
|
|
|
cd $distChocoDir
|
|
|
|
|
choco push
|
|
|
|
|
cd $rootDir
|