-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work around long plugin installation
- Target all branches - Remove admin parameter
- Loading branch information
Showing
3 changed files
with
74 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: 'Install a Visual Studio Extension' | ||
description: 'Download the latest extension version and install in Visual Studio' | ||
inputs: | ||
packagename: | ||
description: 'Package names from the Visual Studio Marketplace URL itemName parameter' | ||
required: true | ||
default: '' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- id: alt-dl | ||
shell: pwsh | ||
run: curl -o mat.vsix https://marketplace.visualstudio.com/_apis/public/gallery/publishers/dts-publisher/vsextensions/mat2022/4.2.1/vspackage | ||
- id: vsix | ||
shell: pwsh | ||
run: | | ||
$baseProtocol = "https:" | ||
$baseHostName = "marketplace.visualstudio.com" | ||
$Uri = "$($baseProtocol)//$($baseHostName)/items?itemName=${{ inputs.packagename }}" | ||
$VsixLocation = "$($env:Temp)\$([guid]::NewGuid()).vsix" | ||
$VSInstallDir = "C:\Program Files (x86)\Microsoft Visual Studio\Installer\resources\app\ServiceHub\Services\Microsoft.VisualStudio.Setup.Service" | ||
if (-Not $VSInstallDir) { | ||
Write-Error "Visual Studio install directory is missing" | ||
Exit 1 | ||
} | ||
Write-Host "Grabbing VSIX extension at $($Uri)" | ||
$HTML = Invoke-WebRequest -Uri $Uri -UseBasicParsing -SessionVariable session | ||
Write-Host "Attempting to download ${{ inputs.packagename }}..." | ||
$anchor = $HTML.Links | | ||
Where-Object { $_.class -eq 'install-button-container' } | | ||
Select-Object -ExpandProperty href | ||
if (-Not $anchor) { | ||
Write-Error "Could not find download anchor tag on the Visual Studio Extensions page" | ||
Exit 1 | ||
} | ||
Write-Host "Anchor is $($anchor)" | ||
$href = "$($baseProtocol)//$($baseHostName)$($anchor)" | ||
Write-Host "Href is $($href)" | ||
Invoke-WebRequest $href -OutFile $VsixLocation -WebSession $session | ||
if (-Not (Test-Path $VsixLocation)) { | ||
Write-Error "Downloaded VSIX file could not be located" | ||
Exit 1 | ||
} | ||
Write-Host "VSInstallDir is $($VSInstallDir)" | ||
Write-Host "VsixLocation is $($VsixLocation)" | ||
Write-Host "Installing ${{ inputs.packagename }}..." | ||
$FilePath = Join-Path $env:GITHUB_WORKSPACE "mat.vsix" | ||
Start-Process -Filepath "$($VSInstallDir)\VSIXInstaller" -WorkingDirectory $env:ProgramFiles -ArgumentList "/q $($FilePath)" -Wait -PassThru | ||
Write-Host "Cleanup..." | ||
rm $VsixLocation | ||
Write-Host "Installation of ${{ inputs.packagename }} complete!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters