From a43d73a00fd5a4f34d28f4171f03c406a0b6f99b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 9 Aug 2018 10:21:36 -0400 Subject: [PATCH] snap update from repo snap --- scripts/snap-update.ps1 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/snap-update.ps1 b/scripts/snap-update.ps1 index cbb3f55f..c312b3cc 100644 --- a/scripts/snap-update.ps1 +++ b/scripts/snap-update.ps1 @@ -1,12 +1,28 @@ -# Dependencies: +param ( + [Parameter(Mandatory=$true)] + [string] $version +) + +# Dependencies: # 1. Install powershell, ex `sudo apt-get install -y powershell` # # To run: -# pwsh ./snap-update.ps1 +# pwsh ./snap-update.ps1 -version 1.5.0 $dir = Split-Path -Parent $MyInvocation.MyCommand.Path; $rootDir = $dir + "/.."; $distDir = $rootDir + "/dist"; -$distSnap = $distDir + "/bitwarden*.snap"; +$distSnapDir = $distDir + "/snap"; + +if(Test-Path -Path $distSnapDir) { + Remove-Item -Recurse -Force $distSnapDir +} +New-Item -ItemType directory -Path $distSnapDir | Out-Null + +$snap = "bitwarden_" + $version + "_amd64.snap"; +$distSnap = $distSnapDir + "/" + $snap; +$uri = "https://github.com/bitwarden/desktop/releases/download/v" + $version + "/" + $snap; +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +Invoke-RestMethod -Uri $uri -OutFile $distSnap snapcraft push $distSnap --release stable