Use Invoke-RestMethod to get tag

This commit is contained in:
Shivam Mathur 2020-05-27 08:02:21 +05:30
parent b84dd3ce25
commit 325413a824
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -51,8 +51,7 @@ Function Get-CleanPSProfile {
Function Install-PhpManager() { Function Install-PhpManager() {
$repo = "mlocati/powershell-phpmanager" $repo = "mlocati/powershell-phpmanager"
$zip_file = "$php_dir\PhpManager.zip" $zip_file = "$php_dir\PhpManager.zip"
$tags = Invoke-WebRequest https://api.github.com/repos/$repo/tags | ConvertFrom-Json $tag = (Invoke-RestMethod https://api.github.com/repos/$repo/tags)[0].Name
$tag = $tags[0].Name
$module_path = "$php_dir\PhpManager\powershell-phpmanager-$tag\PhpManager" $module_path = "$php_dir\PhpManager\powershell-phpmanager-$tag\PhpManager"
Invoke-WebRequest -UseBasicParsing -Uri https://github.com/$repo/archive/$tag.zip -OutFile $zip_file Invoke-WebRequest -UseBasicParsing -Uri https://github.com/$repo/archive/$tag.zip -OutFile $zip_file
Expand-Archive -Path $zip_file -DestinationPath $php_dir\PhpManager Expand-Archive -Path $zip_file -DestinationPath $php_dir\PhpManager