From ed9e49ab702dbb4fa7d6be0797f0d569b3118fdd Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 19 Feb 2018 22:27:43 -0500 Subject: [PATCH] choco pack script with chocolateyinstall updates --- scripts/choco-pack.ps1 | 18 ++++++++++++++++-- stores/chocolatey/tools/chocolateyinstall.ps1 | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/choco-pack.ps1 b/scripts/choco-pack.ps1 index c6f01563..c35d352e 100644 --- a/scripts/choco-pack.ps1 +++ b/scripts/choco-pack.ps1 @@ -1,8 +1,22 @@ $dir = Split-Path -Parent $MyInvocation.MyCommand.Path; $rootDir = $dir + "\.."; $distDir = $rootDir + "\dist"; -$nuspec = $rootDir + "\stores\chocolatey\bitwarden.nuspec"; +$chocoDir = $rootDir + "\stores\chocolatey"; +$distChocoDir = $distDir + "\chocolatey"; + +if(Test-Path -Path $distChocoDir) { + Remove-Item -Recurse -Force $distChocoDir +} + +Copy-Item -Path $chocoDir -Destination $distChocoDir –Recurse + $srcPackage = $rootDir + "\src\package.json"; $srcPackageVersion = (Get-Content -Raw -Path $srcPackage | ConvertFrom-Json).version; -choco pack $nuspec --version $srcPackageVersion --out $distDir +$exe = $distDir + "\nsis-web\Bitwarden Installer " + $srcPackageVersion + ".exe"; +$checksum = checksum -t sha256 $exe +$nuspec = $distChocoDir + "\bitwarden.nuspec"; +$chocoInstall = $distChocoDir + "\tools\chocolateyinstall.ps1"; + +(Get-Content $chocoInstall).replace('__version__', $srcPackageVersion).replace('__checksum__', $checksum) | Set-Content $chocoInstall +choco pack $nuspec --version $srcPackageVersion --out $distChocoDir diff --git a/stores/chocolatey/tools/chocolateyinstall.ps1 b/stores/chocolatey/tools/chocolateyinstall.ps1 index 5bbbf380..d149db9e 100644 --- a/stores/chocolatey/tools/chocolateyinstall.ps1 +++ b/stores/chocolatey/tools/chocolateyinstall.ps1 @@ -1,7 +1,7 @@ $ErrorActionPreference = 'Stop'; -$url = 'https://github.com/bitwarden/desktop/releases/download/v0.0.5/bitwarden-web-setup-0.0.5.exe' -$checksum = '017E5B289EB583E93DB7F108FB5CB0AD28AB44EEE045A8A096B442CAF822567F' +$url = 'https://github.com/bitwarden/desktop/releases/download/v__version__/bitwarden-web-setup-__version__.exe' +$checksum = '__checksum__' $packageArgs = @{ packageName = 'bitwarden'