choco update script downloads exe from github
This commit is contained in:
parent
cbcf361445
commit
273e9bb79d
|
@ -1,5 +1,10 @@
|
||||||
# To run:
|
param (
|
||||||
# .\choco-update.ps1
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string] $version
|
||||||
|
)
|
||||||
|
|
||||||
|
# To run:
|
||||||
|
# .\choco-update.ps1 -version 1.3.0
|
||||||
|
|
||||||
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
$dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
||||||
$rootDir = $dir + "\..";
|
$rootDir = $dir + "\..";
|
||||||
|
@ -13,16 +18,17 @@ if(Test-Path -Path $distChocoDir) {
|
||||||
|
|
||||||
Copy-Item -Path $chocoDir -Destination $distChocoDir –Recurse
|
Copy-Item -Path $chocoDir -Destination $distChocoDir –Recurse
|
||||||
|
|
||||||
$srcPackage = $rootDir + "\src\package.json";
|
$exe = $distChocoDir + "\Bitwarden-Installer-" + $version + ".exe";
|
||||||
$srcPackageVersion = (Get-Content -Raw -Path $srcPackage | ConvertFrom-Json).version;
|
$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
|
||||||
|
|
||||||
$exe = $distDir + "\nsis-web\Bitwarden-Installer-" + $srcPackageVersion + ".exe";
|
|
||||||
$checksum = checksum -t sha256 $exe
|
$checksum = checksum -t sha256 $exe
|
||||||
$nuspec = $distChocoDir + "\bitwarden.nuspec";
|
$nuspec = $distChocoDir + "\bitwarden.nuspec";
|
||||||
$chocoInstall = $distChocoDir + "\tools\chocolateyinstall.ps1";
|
$chocoInstall = $distChocoDir + "\tools\chocolateyinstall.ps1";
|
||||||
|
|
||||||
(Get-Content $chocoInstall).replace('__version__', $srcPackageVersion).replace('__checksum__', $checksum) | Set-Content $chocoInstall
|
(Get-Content $chocoInstall).replace('__version__', $version).replace('__checksum__', $checksum) | Set-Content $chocoInstall
|
||||||
choco pack $nuspec --version $srcPackageVersion --out $distChocoDir
|
choco pack $nuspec --version $version --out $distChocoDir
|
||||||
cd $distChocoDir
|
cd $distChocoDir
|
||||||
choco push
|
choco push
|
||||||
cd $rootDir
|
cd $rootDir
|
||||||
|
|
Loading…
Reference in New Issue