-
Notifications
You must be signed in to change notification settings - Fork 0
/
LatestInstall.ps1
31 lines (21 loc) · 978 Bytes
/
LatestInstall.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env pwsh
$ErrorActionPreference = 'Stop'
# GitHub requires TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$LatestTag = (gh release list -L 1).split()[0]
Write-Host "Latest Tag: $LatestTag"
$MsixPath = "ecsact_sdk_$($LatestTag)_windows_x64.msix"
$MsixDownloadUrl = "https://github.com/ecsact-dev/ecsact_sdk/releases/download/$($LatestTag)/$($MsixPath)"
if (-not(Test-Path -Path $MsixPath -PathType Leaf)) {
Write-Host "Downloading $MsixDownloadUrl ..."
Invoke-WebRequest $MsixDownloadUrl -OutFile $MsixPath -UseBasicParsing
}
$ExistingPackage = Get-AppPackage EcsactSdk
if ($ExistingPackage) {
Write-Host "Removing old package $($ExistingPackage.PackageFullName) .."
Remove-AppPackage -Package $ExistingPackage.PackageFullName
}
Write-Host "Adding new package $($MsixPath) ..."
Add-AppPackage -Path $MsixPath
$ExistingPackage = Get-AppPackage EcsactSdk
Write-Host "$($ExistingPackage.PackageFullName) installed!"