2018-04-20 02:28:35 +02:00
|
|
|
|
# To run:
|
|
|
|
|
# .\choco-pack.ps1
|
|
|
|
|
#
|
|
|
|
|
# and then push to choco with:
|
|
|
|
|
# cd ..\dist\chocolatey
|
|
|
|
|
# choco push
|
|
|
|
|
|
|
|
|
|
$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-02-20 03:56:46 +01:00
|
|
|
|
$srcPackage = $rootDir + "\src\package.json";
|
|
|
|
|
$srcPackageVersion = (Get-Content -Raw -Path $srcPackage | ConvertFrom-Json).version;
|
|
|
|
|
|
2018-02-28 15:18:35 +01:00
|
|
|
|
$exe = $distDir + "\nsis-web\Bitwarden-Installer-" + $srcPackageVersion + ".exe";
|
2018-02-20 04:27:43 +01:00
|
|
|
|
$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
|